Submission #1076025


Source Code Expand

Copy
N = int(input())
B = [[] for _ in range(N)]
checked = [False]*N
for i in range(1,N):
	t = int(input()) - 1
	B[t].append(i)
ans = [0]*N
while not checked[0]:
	for i in range(N):
		if not checked[i]:
			if B[i]:
				f = 0
				C = []
				for a in B[i]:
					if not checked[a]:
						f = 1
						break
					else:
						C.append(ans[a])
				if not f:
					C.sort()
					C.reverse()
					l = len(C)
					ans[i] = max([j+C[j]+1 for j in range(l)])
					checked[i] = True
			else:
				checked[i] = True
print(ans[0])

Submission Info

Submission Time
Task B - Tournament
User TAB
Language Python (3.4.3)
Score 0
Code Size 535 Byte
Status
Exec Time 2103 ms
Memory 20476 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 800
Status
× 3
× 43
× 10
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, 49.txt, 50.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 714 ms 17328 KB
02.txt 672 ms 17456 KB
03.txt 669 ms 17328 KB
04.txt 712 ms 17328 KB
05.txt 723 ms 17328 KB
06.txt 659 ms 17328 KB
07.txt 671 ms 17328 KB
08.txt 688 ms 17332 KB
09.txt 691 ms 17328 KB
10.txt 679 ms 17328 KB
11.txt 2103 ms 19504 KB
12.txt 2103 ms 18352 KB
13.txt 2103 ms 18224 KB
14.txt 2103 ms 17968 KB
15.txt 2103 ms 17968 KB
16.txt 2103 ms 17840 KB
17.txt 2103 ms 17816 KB
18.txt 2103 ms 17840 KB
19.txt 2103 ms 17840 KB
20.txt 2103 ms 17840 KB
21.txt 347 ms 20476 KB
22.txt 350 ms 18092 KB
23.txt 363 ms 17420 KB
24.txt 361 ms 16872 KB
25.txt 374 ms 16512 KB
26.txt 389 ms 16256 KB
27.txt 407 ms 16128 KB
28.txt 531 ms 16000 KB
29.txt 673 ms 15980 KB
30.txt 957 ms 16016 KB
31.txt 553 ms 17200 KB
32.txt 496 ms 16432 KB
33.txt 443 ms 16052 KB
34.txt 448 ms 16176 KB
35.txt 410 ms 16432 KB
36.txt 383 ms 15792 KB
37.txt 381 ms 15792 KB
38.txt 362 ms 15780 KB
39.txt 350 ms 15744 KB
40.txt 357 ms 15872 KB
41.txt 23 ms 3064 KB
42.txt 22 ms 3064 KB
43.txt 23 ms 3064 KB
44.txt 23 ms 3064 KB
45.txt 23 ms 3064 KB
46.txt 23 ms 3064 KB
47.txt 23 ms 3064 KB
48.txt 23 ms 3064 KB
49.txt 23 ms 3064 KB
50.txt 23 ms 3064 KB
s1.txt 23 ms 3064 KB
s2.txt 23 ms 3064 KB
s3.txt 23 ms 3064 KB