Cut the Negativity
This commit is contained in:
14
cutthenegativity.py
Normal file
14
cutthenegativity.py
Normal 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)))
|
||||
Reference in New Issue
Block a user