CSES - Datatähti 2022 alku - Results
 Task: Tietoverkko (Network) Sender: Bliz Submission time: 2021-10-16 15:05:15 Language: CPython3 Status: READY Result: 0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#1--1, 2, 3details
#2--2, 3details
#3--3details

### 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

Group: 1, 2, 3

Verdict:

input
100
1 2 74
1 3 100
2 4 50
3 5 40
...

correct output
88687

user output
(empty)

Group: 2, 3

Verdict:

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:

input
200000
1 2 613084013
1 3 832364259
2 4 411999902
3 5 989696303
...

correct output
1080549209850010931

user output
(empty)