| Task: | Download Speed |
| Sender: | azeaus1 |
| Submission time: | 2025-10-22 10:51:19 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | details |
| #2 | WRONG ANSWER | 0.04 s | details |
| #3 | ACCEPTED | 0.04 s | details |
| #4 | ACCEPTED | 0.04 s | details |
| #5 | WRONG ANSWER | 0.07 s | details |
| #6 | WRONG ANSWER | 0.22 s | details |
| #7 | WRONG ANSWER | 0.40 s | details |
| #8 | ACCEPTED | 0.04 s | details |
| #9 | ACCEPTED | 0.04 s | details |
| #10 | WRONG ANSWER | 0.04 s | details |
| #11 | WRONG ANSWER | 0.07 s | details |
| #12 | WRONG ANSWER | 0.04 s | details |
Code
n, m = [int(x) for x in input().split()]
graph = [[[-1,-1] for _ in range(n)] for _ in range(n)]
max_value = 0
for _ in range(m):
a, b, c = [int(x) for x in input().split()]
graph[a-1][b-1] = [c, 0]
max_value += c
def dfs(threshold, visited, x):
visited[x] = True
if x == n-1:
return (True, [])
for i, (weight, rev_weight) in enumerate(graph[x]):
if not visited[i] and weight >= threshold:
res = dfs(threshold, visited, i)
if res[0]:
res[1].append(i)
return (True, res[1])
return (False, [])
def scaling():
global max_value, n
res = dfs(max_value, [False]*n, 0)
while not res[0] and max_value > 0:
max_value = max_value//2
if max_value > 0:
res = dfs(max_value, [False]*n, 0)
if not res[0] or res[1][0] != n-1:
return (False, 0)
res[1].append(0)
min = float('inf')
max = 0
for i in range(len(res[1])-1):
if graph[res[1][i+1]][res[1][i]][0] < min:
min = graph[res[1][i+1]][res[1][i]][0]
for i in range(len(res[1])-1):
graph[res[1][i+1]][res[1][i]][0] -= min
graph[res[1][i+1]][res[1][i]][1] += min
if graph[res[1][i+1]][res[1][i]][1] > max:
max = graph[res[1][i+1]][res[1][i]][1]
return (True, max)
res = scaling()
super_max = 0
while res[0]:
super_max += res[1]
res = scaling()
print(super_max)Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 4 3 1 2 5 2 3 3 3 4 6 |
| correct output |
|---|
| 3 |
| user output |
|---|
| 3 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 4 5 1 2 1 1 3 1 2 3 1 2 4 1 ... |
| correct output |
|---|
| 2 |
| user output |
|---|
| 1 |
Feedback: Incorrect character on line 1 col 1: expected "2", got "1"
Test 3
Verdict: ACCEPTED
| input |
|---|
| 4 5 1 2 1000000000 1 3 1000000000 2 3 1 2 4 1000000000 ... |
| correct output |
|---|
| 2000000000 |
| user output |
|---|
| 2000000000 |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 2 1 2 1 100 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 2 1000 1 2 1000000000 1 2 1000000000 1 2 1000000000 1 2 1000000000 ... |
| correct output |
|---|
| 1000000000000 |
| user output |
|---|
| 1000000000 |
Feedback: Incorrect character on line 1 col 11: expected "1000000000000", got "1000000000"
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 500 998 1 2 54 1 3 59 1 4 83 2 5 79 ... |
| correct output |
|---|
| 60 |
| user output |
|---|
| 137 |
Feedback: Incorrect character on line 1 col 1: expected "60", got "137"
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 500 998 1 2 530873053 1 3 156306296 1 4 478040476 3 5 303609600 ... |
| correct output |
|---|
| 1093765123 |
| user output |
|---|
| 5434708235 |
Feedback: Incorrect character on line 1 col 1: expected "1093765123", got "5434708235"
Test 8
Verdict: ACCEPTED
| input |
|---|
| 2 1 1 2 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 9
Verdict: ACCEPTED
| input |
|---|
| 4 5 1 2 3 2 4 2 1 3 4 3 4 5 ... |
| correct output |
|---|
| 6 |
| user output |
|---|
| 6 |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 4 5 1 2 1 1 3 2 3 2 1 2 4 2 ... |
| correct output |
|---|
| 3 |
| user output |
|---|
| 5 |
Feedback: Incorrect character on line 1 col 1: expected "3", got "5"
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 10 999 1 2 1000000000 1 2 1000000000 1 2 1000000000 1 2 1000000000 ... |
| correct output |
|---|
| 111000000000 |
| user output |
|---|
| 1000000000 |
Feedback: Incorrect character on line 1 col 2: expected "111000000000", got "1000000000"
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 7 9 1 2 1 1 3 1 1 4 1 2 5 1 ... |
| correct output |
|---|
| 2 |
| user output |
|---|
| 1 |
Feedback: Incorrect character on line 1 col 1: expected "2", got "1"
