| Task: | Airport |
| Sender: | aalto25h_003 |
| Submission time: | 2025-10-22 17:45:28 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.07 s | details |
| #2 | RUNTIME ERROR | 0.07 s | details |
| #3 | RUNTIME ERROR | 0.07 s | details |
| #4 | RUNTIME ERROR | 0.07 s | details |
| #5 | RUNTIME ERROR | 0.07 s | details |
| #6 | RUNTIME ERROR | 0.09 s | details |
| #7 | RUNTIME ERROR | 0.09 s | details |
| #8 | RUNTIME ERROR | 0.09 s | details |
| #9 | RUNTIME ERROR | 0.09 s | details |
| #10 | RUNTIME ERROR | 0.09 s | details |
| #11 | RUNTIME ERROR | 0.07 s | details |
| #12 | RUNTIME ERROR | 0.07 s | details |
| #13 | RUNTIME ERROR | 0.07 s | details |
Code
from collections import defaultdict, deque
def airport():
n, m = map(int, input().split())
checkpoint_capacity = list(map(int, input().split()))
graph = defaultdict(lambda: defaultdict(int))
for i in range(n):
if checkpoint_capacity[i] == -1:
graph[2*i+1][2*i+2] = float('inf')
else:
graph[2*i+1][2*i+2] = checkpoint_capacity[i]
for _ in range(m):
a, b = map(int, input().split())
graph[2*a][2*b-1] = float('inf')
def find_path(source, sink, parent):
visited = set([source])
queue = deque([source])
while queue:
u = queue.popleft()
for v in graph[u]:
if v not in visited and graph[u][v] > 0:
visited.add(v)
parent[v] = u
queue.append(v)
if v == sink:
return True
return False
max_flow = 0
source = 1
sink = 2*n
while True:
parent = {}
if not find_path(source, sink, parent):
break
v = sink
while v != source:
u = parent[v]
path_flow = min(path_flow, graph[u][v])
v = u
v = sink
while v != source:
u = parent[v]
graph[u][v] -= path_flow
graph[v][u] += path_flow
v = u
max_flow += path_flow
print(max_flow)
if __name__ == "__main__":
airport()Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 10 20 -1 85 7 19 90 72 11 46 65 -1 6 7 9 7 8 4 ... |
| correct output |
|---|
| 7 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 2
Verdict: RUNTIME ERROR
| input |
|---|
| 10 20 -1 80 77 57 77 95 63 98 30 -1 6 7 8 9 7 8 ... |
| correct output |
|---|
| 30 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 3
Verdict: RUNTIME ERROR
| input |
|---|
| 10 20 -1 63 16 42 62 70 9 94 68 -1 10 9 6 8 10 6 ... |
| correct output |
|---|
| 25 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 4
Verdict: RUNTIME ERROR
| input |
|---|
| 10 20 -1 3 86 -1 32 34 9 50 -1 -1 6 7 7 8 9 2 ... |
| correct output |
|---|
| 3 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 5
Verdict: RUNTIME ERROR
| input |
|---|
| 10 20 -1 43 38 -1 7 54 26 97 76 -1 3 9 9 10 6 7 ... |
| correct output |
|---|
| 76 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 6
Verdict: RUNTIME ERROR
| input |
|---|
| 100 1000 -1 425576195 274150382 1021768... |
| correct output |
|---|
| 6091126630 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 7
Verdict: RUNTIME ERROR
| input |
|---|
| 100 1000 -1 769953265 -1 389517741 2323... |
| correct output |
|---|
| 769953265 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 8
Verdict: RUNTIME ERROR
| input |
|---|
| 100 1000 -1 584988267 763129662 6781413... |
| correct output |
|---|
| 1699511766 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 9
Verdict: RUNTIME ERROR
| input |
|---|
| 100 1000 -1 921671366 121044688 2933366... |
| correct output |
|---|
| 1805833567 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 10
Verdict: RUNTIME ERROR
| input |
|---|
| 100 1000 -1 763842763 612011030 4532521... |
| correct output |
|---|
| 3342235784 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 11
Verdict: RUNTIME ERROR
| input |
|---|
| 3 3
-1 1 -1 1 2 2 3 2 2 |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 12
Verdict: RUNTIME ERROR
| input |
|---|
| 3 4
-1 1 -1 1 2 1 2 2 3 ... |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignmentTest 13
Verdict: RUNTIME ERROR
| input |
|---|
| 7 8 -1 1 1 1 1 1 -1 1 2 1 3 2 4 ... |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 58, in <module>
airport()
File "input/code.py", line 46, in airport
path_flow = min(path_flow, graph[u][v])
UnboundLocalError: local variable 'path_flow' referenced before assignment