| Task: | Download Speed |
| Sender: | Abduvohid |
| Submission time: | 2025-10-08 21:13:50 +0300 |
| Language: | Python2 (PyPy2) |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.03 s | details |
| #2 | RUNTIME ERROR | 0.03 s | details |
| #3 | RUNTIME ERROR | 0.03 s | details |
| #4 | RUNTIME ERROR | 0.04 s | details |
| #5 | RUNTIME ERROR | 0.04 s | details |
| #6 | RUNTIME ERROR | 0.03 s | details |
| #7 | RUNTIME ERROR | 0.03 s | details |
| #8 | RUNTIME ERROR | 0.03 s | details |
| #9 | RUNTIME ERROR | 0.04 s | details |
| #10 | RUNTIME ERROR | 0.03 s | details |
| #11 | RUNTIME ERROR | 0.03 s | details |
| #12 | RUNTIME ERROR | 0.03 s | details |
Code
from collections import deque
infinity = float("inf")
def bfs(G, source, sink, parent):
visited = set()
queue = deque()
queue.append(source)
visited.add(source)
while queue:
node = queue.popleft()
for i in range(len(G[node])):
if i not in visited and G[node][i] > 0:
queue.append(i)
visited.add(i)
parent[i] = node
return sink in visited
def ford_fulkerson(G, source, sink):
parent = [-1] * (len(G))
max_flow = 0
while bfs(G, source, sink, parent):
path_flow = infinity
s = sink
while s != source:
path_flow = min(path_flow, G[parent[s]][s])
s = parent[s]
max_flow += path_flow
v = sink
while v != source:
u = parent[v]
G[u][v] -= path_flow
G[v][u] += path_flow
v = parent[v]
return max_flow
def main():
#G = make_graph()
n, m = map(int, input().split())
source = 0
sink = n - 1
graph = [[0 for _ in range(n)] for _ in range(n)]
#print(graph)
for _ in range(m):
a, b, c = map(int, input().split())
graph[a-1][b-1] = c
#graph[b-1][a-1] = c
#print(graph)
#print graph
max_flow = ford_fulkerson(graph, source, sink)
print(f'{max_flow}')
main()Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 4 3 1 2 5 2 3 3 3 4 6 |
| correct output |
|---|
| 3 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| 4 5 1 2 1 1 3 1 2 3 1 2 4 1 ... |
| correct output |
|---|
| 2 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| 4 5 1 2 1000000000 1 3 1000000000 2 3 1 2 4 1000000000 ... |
| correct output |
|---|
| 2000000000 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| 2 1 2 1 100 |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| 2 1000 1 2 1000000000 1 2 1000000000 1 2 1000000000 1 2 1000000000 ... |
| correct output |
|---|
| 1000000000000 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| 500 998 1 2 54 1 3 59 1 4 83 2 5 79 ... |
| correct output |
|---|
| 60 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 500 998 1 2 530873053 1 3 156306296 1 4 478040476 3 5 303609600 ... |
| correct output |
|---|
| 1093765123 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| 2 1 1 2 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| 4 5 1 2 3 2 4 2 1 3 4 3 4 5 ... |
| correct output |
|---|
| 6 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| 4 5 1 2 1 1 3 2 3 2 1 2 4 2 ... |
| correct output |
|---|
| 3 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 11
Verdict: RUNTIME ERROR
| input |
|---|
| 10 999 1 2 1000000000 1 2 1000000000 1 2 1000000000 1 2 1000000000 ... |
| correct output |
|---|
| 111000000000 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')Test 12
Verdict: RUNTIME ERROR
| input |
|---|
| 7 9 1 2 1 1 3 1 1 4 1 2 5 1 ... |
| correct output |
|---|
| 2 |
| user output |
|---|
| (empty) |
Error:
File "input/code.py", line 65
print(f'{max_flow}')
^
SyntaxError: invalid syntax (expected ')')