| Task: | Company Queries II |
| Sender: | jonnymorgan |
| Submission time: | 2025-10-23 15:15:44 +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.06 s | details |
| #4 | RUNTIME ERROR | 0.06 s | details |
| #5 | RUNTIME ERROR | 0.07 s | details |
| #6 | RUNTIME ERROR | 0.42 s | details |
| #7 | RUNTIME ERROR | 0.42 s | details |
| #8 | RUNTIME ERROR | 0.42 s | details |
| #9 | RUNTIME ERROR | 0.42 s | details |
| #10 | RUNTIME ERROR | 0.42 s | details |
| #11 | RUNTIME ERROR | 0.06 s | details |
| #12 | RUNTIME ERROR | 0.42 s | details |
Code
from collections import deque
def bfs(s, t, parent, capacity, adj):
parent[:] = [-1] * len(parent)
parent[s] = -2
q = deque([(s, float('inf'))])
while q:
cur, flow = q.popleft()
for nxt in adj[cur]:
if parent[nxt] == -1 and capacity[cur][nxt]:
parent[nxt] = cur
new_flow = min(flow, capacity[cur][nxt])
if nxt == t:
return new_flow
q.append((nxt, new_flow))
return 0
n, m = map(int, input().split())
capacity = [[0] * (n + 1) for _ in range(n + 1)]
adj = [[] for _ in range(n + 1)]
for _ in range(m):
a, b, c = map(int, input().split())
capacity[a][b] += c
adj[a].append(b)
adj[b].append(a)
flow = 0
parent = [-1] * (n + 1)
while True:
new_flow = bfs(1, n, parent, capacity, adj)
if new_flow == 0:
break
flow += new_flow
cur = n
while cur != 1:
prev = parent[cur]
capacity[prev][cur] -= new_flow
capacity[cur][prev] += new_flow
cur = prev
print(flow)Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 1 2 3 4 5 6 7 8 9 6 9 8 10 10 3 ... |
| correct output |
|---|
| 6 8 3 1 8 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 26, in <module>
a, b, c = map(int, input().split())
ValueError: too many values to unpack (expected 3)Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 1 1 1 1 1 1 1 1 1 1 7 3 4 4 1 ... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 26, in <module>
a, b, c = map(int, input().split())
ValueError: too many values to unpack (expected 3)Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 1 1 1 1 2 3 4 4 1 1 8 2 7 8 3 ... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 26, in <module>
a, b, c = map(int, input().split())
ValueError: too many values to unpack (expected 3)Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 1 1 3 1 2 2 5 3 9 7 2 7 6 3 9 ... |
| correct output |
|---|
| 2 2 3 1 1 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 26, in <module>
a, b, c = map(int, input().split())
ValueError: too many values to unpack (expected 3)Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 1 2 3 2 5 3 2 2 4 6 1 1 3 1 9 ... |
| correct output |
|---|
| 1 1 1 2 2 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 26, in <module>
a, b, c = map(int, input().split())
ValueError: too many values to unpack (expected 3)Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| 200000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 74862 8750 16237 72298 58111 ... |
| user output |
|---|
| (empty) |
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 200000 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| 200000 200000 1 2 1 2 3 2 1 6 3 1 10 12 13 4... |
| correct output |
|---|
| 1 2 2 2 1 ... |
| user output |
|---|
| (empty) |
Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| 200000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 2796 633 633 151 2690 ... |
| user output |
|---|
| (empty) |
Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| 200000 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 365 73 103 365 216 ... |
| user output |
|---|
| (empty) |
Test 11
Verdict: RUNTIME ERROR
| input |
|---|
| 2 4 1 1 1 1 2 2 1 ... |
| correct output |
|---|
| 1 1 1 2 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 26, in <module>
a, b, c = map(int, input().split())
ValueError: not enough values to unpack (expected 3, got 1)Test 12
Verdict: RUNTIME ERROR
| input |
|---|
| 200000 200000 1 1 2 3 4 5 6 7 8 9 10 11 12 1... |
| correct output |
|---|
| 27468 6353 27468 6353 6353 ... |
| user output |
|---|
| (empty) |
