Cut the Negativity

This commit is contained in:
2023-06-23 22:21:20 +02:00
parent 983cca1f55
commit a9261eeab3

14
cutthenegativity.py Normal file
View File

@@ -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)))