Task: | Sadonkorjuu |
Sender: | progamer |
Submission time: | 2022-11-08 21:00:44 +0200 |
Language: | Python3 (CPython3) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#2 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#3 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#4 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#5 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#6 | RUNTIME ERROR | 0.02 s | 1, 2 | details |
#7 | TIME LIMIT EXCEEDED | -- | 2 | details |
#8 | RUNTIME ERROR | 0.03 s | 1, 2 | details |
#9 | TIME LIMIT EXCEEDED | -- | 2 | details |
#10 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#11 | TIME LIMIT EXCEEDED | -- | 2 | details |
#12 | TIME LIMIT EXCEEDED | -- | 2 | details |
#13 | TIME LIMIT EXCEEDED | -- | 2 | details |
#14 | TIME LIMIT EXCEEDED | -- | 2 | details |
#15 | RUNTIME ERROR | 0.03 s | 1, 2 | details |
#16 | WRONG ANSWER | 0.03 s | 1, 2 | details |
#17 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#18 | RUNTIME ERROR | 0.02 s | 1, 2 | details |
#19 | WRONG ANSWER | 0.02 s | 1, 2 | details |
#20 | RUNTIME ERROR | 0.02 s | 1, 2 | details |
#21 | TIME LIMIT EXCEEDED | -- | 2 | details |
#22 | TIME LIMIT EXCEEDED | -- | 2 | details |
#23 | TIME LIMIT EXCEEDED | -- | 2 | details |
#24 | RUNTIME ERROR | 0.03 s | 1, 2 | details |
#25 | TIME LIMIT EXCEEDED | -- | 2 | details |
#26 | RUNTIME ERROR | 0.03 s | 1, 2 | details |
#27 | TIME LIMIT EXCEEDED | -- | 2 | details |
#28 | RUNTIME ERROR | 0.02 s | 1, 2 | details |
#29 | TIME LIMIT EXCEEDED | -- | 2 | details |
#30 | RUNTIME ERROR | 0.02 s | 1, 2 | details |
#31 | TIME LIMIT EXCEEDED | -- | 2 | details |
Code
n = int(input()) kohde = [list(map(int, input().split()))] g = [list(map(int, input().split())) for _ in range(n-1)] """n = 6 kohde = [[1, 1, 0, 0, 1, 1]] g = [[1, 2, 20], [2, 3, 30], [2, 5, 50], [3, 6, 60], [1, 4, 10]]""" nodes = [[] for _ in range(n)] pituus = [[] for _ in range(n)] for i in range(n-1): nodes[g[i][0]-1].append(g[i][1]) nodes[g[i][1]-1].append(g[i][0]) pituus[g[i][0]-1].append(g[i][2]) pituus[g[i][1]-1].append(g[i][2]) print(pituus) print(nodes) ans = [[] for _ in range(n)] visited = [0]*n """def SearchQueue(queue): print(" ") for i in queue: MinSearch(i[0], i[1], i[2], i[3])""" def MinSearch(node, cur, visited, ans): global nodes, kohde, pituus pileup = 0 visited.append(cur) lul = [] for i in range(len(node)): #print(node[i], "last") if kohde[0][node[i]-1] == 0: #print(ans, pituus[cur-1][i], node, i, cur) #print("lol") lul.append(ans + pituus[cur-1][i]) return [ans + pituus[cur-1][i], lul] if node[i] not in visited: visited.append(node[i]) #print(node, node[i]) pileup += pituus[cur-1][i] #print(pileup) ans += MinSearch(nodes[node[i]-1], node[i], visited, pileup)[0] lul.append(ans) #print(ans, "ans") ans = 0 #print("lolxd") return [ans + pituus[cur-1][i], [lul[0]+ans + pituus[cur-1][i]]] """ 5 20 10 4 lol 80 ans 0 30 3 lol 30 ans lolxd [30] """ # 10 # 30 # # # 70 # 60 #for i in range(n): #print("Start", 0+1, '\n') for i in range(n): if kohde[0][i] == 1: #print(i+1) print( min( MinSearch(nodes[i], i+1, [], 0)[1] ) ) #print("End", 0+1, '\n') """ [[2, 4], [1, 3, 5], [2, 6], [1], [2], [3]] 1: [1, 3, 5] [1] [2, 6] [2] [3] 2: [2, 4] [2, 6] [2] [1] [3] 3: [1, 3, 5] [3] [2, 4] [2] [1] 4: [2, 4] [1, 3, 5] [2, 6] [2] [3] 5: [1, 3, 5] [2, 4] [2, 6] [1] [3] 6: [2, 6] [1, 3, 5] [2, 4] [2] [1] ******************************* 0 1 | | 4 20 10 2 | | 5 30 50 3 | 60 6 1: [20] [10] [30] [50] [60] 2: [20] [30] [50] [10] [60] 3: [30] [60] [20] [50] [10] 4: [10] [20] [30] [50] [60] 5: [50] [20] [30] [10] [60] 6: [60] [30] [20] [50] [10] 1: +20 a: +50 = 70 b: +30 = 50 +10 = 10 2: +20 +10 +50 +30 +60 3: +30 a: +50 = 80 b: +20 +10 = 60 4: +10 +20 a: +50 = 70 b: +30 +60 = 110 5: +50 a: +30 +60 = 140 b: +20 +10 = 80 6: +60 +30 a: +50 b: +20 +10 """
Test details
Test 1
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
1 0 |
correct output |
---|
0 |
user output |
---|
[[]] [[]] |
Test 2
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
5 0 0 0 0 0 1 2 1 2 3 2 3 4 3 ... |
correct output |
---|
0 |
user output |
---|
[[1], [1, 2], [2, 3], [3, 4], ... |
Test 3
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
4 1 0 1 1 1 2 10 2 3 20 2 4 30 |
correct output |
---|
60 |
user output |
---|
[[10], [10, 20, 30], [20], [30... |
Test 4
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
5 0 1 1 1 0 1 2 10 2 3 20 3 4 30 ... |
correct output |
---|
80 |
user output |
---|
[[10], [10, 20], [20, 30], [30... |
Test 5
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
5 0 1 0 1 1 1 2 1 2 3 5 3 4 3 ... |
correct output |
---|
6 |
user output |
---|
[[1], [1, 5], [5, 3, 2], [3], ... |
Test 6
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
5506363 |
user output |
---|
[[888, 628, 151, 936, 815, 389... Truncated |
Error:
Traceback (most recent call last): File "/box/input/code.py", line 86, in <module> m...
Test 7
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1795118520 |
user output |
---|
(empty) |
Test 8
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
1000 0 0 1 0 1 1 0 1 0 1 1 0 0 0 1 ... |
correct output |
---|
293576 |
user output |
---|
[[360, 876, 916, 167, 619], [8... Truncated |
Error:
Traceback (most recent call last): File "/box/input/code.py", line 86, in <module> m...
Test 9
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
816932444 |
user output |
---|
(empty) |
Test 10
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
correct output |
---|
3089 |
user output |
---|
[[215, 505, 439, 947, 679], [5... Truncated |
Test 11
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
correct output |
---|
40839 |
user output |
---|
(empty) |
Test 12
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
5683983203973 |
user output |
---|
(empty) |
Test 13
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 0 1 1 1 1 1 1 0 0 0 1 1 0 1 0 ... |
correct output |
---|
58572993 |
user output |
---|
(empty) |
Test 14
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
correct output |
---|
32755 |
user output |
---|
(empty) |
Test 15
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
126238345 |
user output |
---|
[[396], [396, 543], [543, 360]... Truncated |
Error:
Traceback (most recent call last): File "/box/input/code.py", line 86, in <module> m...
Test 16
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
1000 0 0 0 1 0 1 1 1 0 0 1 0 1 1 0 ... |
correct output |
---|
278678 |
user output |
---|
[[759], [759, 610], [610, 779]... Truncated |
Test 17
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
1000 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 ... |
correct output |
---|
34929 |
user output |
---|
[[444], [444, 892], [892, 417]... Truncated |
Test 18
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1543963 |
user output |
---|
[[824, 876], [824, 834, 773], ... Truncated |
Error:
Traceback (most recent call last): File "/box/input/code.py", line 86, in <module> m...
Test 19
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
correct output |
---|
39606 |
user output |
---|
[[187, 164], [187, 600, 295], ... Truncated |
Test 20
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
1000 1 0 1 0 1 0 0 0 0 1 1 0 0 0 1 ... |
correct output |
---|
321598 |
user output |
---|
[[370, 19], [370, 714, 372], [... Truncated |
Error:
Traceback (most recent call last): File "/box/input/code.py", line 86, in <module> m...
Test 21
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
978670626 |
user output |
---|
(empty) |
Test 22
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
correct output |
---|
375218 |
user output |
---|
(empty) |
Test 23
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 1 1 1 0 0 0 0 0 1 0 1 0 1 1 ... |
correct output |
---|
60422556 |
user output |
---|
(empty) |
Test 24
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
291990 |
user output |
---|
[[646, 963], [646, 733, 978], ... Truncated |
Error:
Traceback (most recent call last): File "/box/input/code.py", line 86, in <module> m...
Test 25
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
59607954 |
user output |
---|
(empty) |
Test 26
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
990 |
user output |
---|
[[1, 1], [1, 1, 1], [1, 1, 1],... Truncated |
Error:
Traceback (most recent call last): File "/box/input/code.py", line 86, in <module> m...
Test 27
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
199982 |
user output |
---|
(empty) |
Test 28
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
1000 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
7987 |
user output |
---|
[[1, 1], [1, 1, 1], [1, 1, 1],... Truncated |
Error:
Traceback (most recent call last): File "/box/input/code.py", line 86, in <module> m...
Test 29
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
3137875 |
user output |
---|
(empty) |
Test 30
Group: 1, 2
Verdict: RUNTIME ERROR
input |
---|
1000 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
4657693 |
user output |
---|
[[583, 950], [583, 212, 888], ... Truncated |
Error:
Traceback (most recent call last): File "/box/input/code.py", line 86, in <module> m...
Test 31
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
1652889357 |
user output |
---|
(empty) |