Task: | Tietoverkko |
Sender: | Bliz |
Submission time: | 2021-10-16 15:05:15 +0300 |
Language: | Python3 (CPython3) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
#2 | TIME LIMIT EXCEEDED | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#2 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#3 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
import copy def get_result(net, i, j, speed=0): if i == j: return speed # Poista takaisin päin osoittavat yhteydet for point in net[i]: net[point[0]].remove((i, point[1])) for point in net[i]: r = get_result(net, point[0], j, min(speed, point[1]) if speed else point[1]) if r: return r else: return 0 n = int(input()) net = [[] for i in range(n + 1)] for i in range(n - 1): a, b, x = map(int, input().split()) net[a].append((b, x)) net[b].append((a, x)) r = 0 for i in range(2, n + 1): for j in range(1, i): r += get_result(copy.deepcopy(net), i, j) print(r)
Test details
Test 1
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 1 2 74 1 3 100 2 4 50 3 5 40 ... |
correct output |
---|
88687 |
user output |
---|
(empty) |
Test 2
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
5000 1 2 613084013 1 3 832364259 2 4 411999902 3 5 989696303 ... |
correct output |
---|
1103702320243776 |
user output |
---|
(empty) |
Test 3
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 2 613084013 1 3 832364259 2 4 411999902 3 5 989696303 ... |
correct output |
---|
1080549209850010931 |
user output |
---|
(empty) |