From a9261eeab301842255a3fae2745c9c33750a47e0 Mon Sep 17 00:00:00 2001 From: Jethro Stapelbroek Date: Fri, 23 Jun 2023 22:21:20 +0200 Subject: [PATCH] Cut the Negativity --- cutthenegativity.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 cutthenegativity.py diff --git a/cutthenegativity.py b/cutthenegativity.py new file mode 100644 index 0000000..5e39218 --- /dev/null +++ b/cutthenegativity.py @@ -0,0 +1,14 @@ +n = int(input()) + +output = [] +row = 1 +for _ in range(n): + costs = map(int, input().split()) + for col, cost in enumerate(costs, start=1): + if cost >= 0: + output.append([row, col, cost]) + row += 1 +print(len(output)) +for m in output: + u, v, c = map(str, m) + print(" ".join((u, v, c)))