n,k=map(int,input().split())
disagree=[]
enemies=[]
for i in range(n):
s=set()
q=input().split()
for j in range(1,len(q)):
s.add(int(q[j]))
enemies.append([-int(q[0]),i])
disagree.append(s)
enemies=sorted(enemies)
def juntar(a,comun,disagree,tam,m,k):
for i in comun:
m=max(m,tam+1)
if(m==k):
break
m=juntar(i,comun&disagree[i],disagree,tam+1,m,k)
return m
m=1
for i in range(n):
a=enemies[i][1]
m=juntar(a,disagree[a],disagree,1,m,k)
if(m==k):
break
print(m)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
3416 KB |
Output is correct |
2 |
Correct |
11 ms |
2908 KB |
Output is correct |
3 |
Correct |
28 ms |
5276 KB |
Output is correct |
4 |
Correct |
25 ms |
5592 KB |
Output is correct |
5 |
Correct |
25 ms |
5592 KB |
Output is correct |
6 |
Correct |
26 ms |
5212 KB |
Output is correct |
7 |
Correct |
34 ms |
5308 KB |
Output is correct |
8 |
Correct |
23 ms |
4700 KB |
Output is correct |
9 |
Correct |
11 ms |
3040 KB |
Output is correct |
10 |
Correct |
21 ms |
4700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
3416 KB |
Output is correct |
2 |
Correct |
11 ms |
2908 KB |
Output is correct |
3 |
Correct |
28 ms |
5276 KB |
Output is correct |
4 |
Correct |
25 ms |
5592 KB |
Output is correct |
5 |
Correct |
25 ms |
5592 KB |
Output is correct |
6 |
Correct |
26 ms |
5212 KB |
Output is correct |
7 |
Correct |
34 ms |
5308 KB |
Output is correct |
8 |
Correct |
23 ms |
4700 KB |
Output is correct |
9 |
Correct |
11 ms |
3040 KB |
Output is correct |
10 |
Correct |
21 ms |
4700 KB |
Output is correct |
11 |
Correct |
28 ms |
5580 KB |
Output is correct |
12 |
Correct |
32 ms |
5584 KB |
Output is correct |
13 |
Correct |
10 ms |
2908 KB |
Output is correct |
14 |
Correct |
32 ms |
5656 KB |
Output is correct |
15 |
Correct |
10 ms |
2908 KB |
Output is correct |
16 |
Correct |
33 ms |
5208 KB |
Output is correct |
17 |
Correct |
10 ms |
2908 KB |
Output is correct |
18 |
Correct |
33 ms |
5080 KB |
Output is correct |
19 |
Correct |
23 ms |
4700 KB |
Output is correct |
20 |
Correct |
24 ms |
4952 KB |
Output is correct |
21 |
Correct |
25 ms |
4964 KB |
Output is correct |
22 |
Correct |
23 ms |
4692 KB |
Output is correct |
23 |
Correct |
30 ms |
5416 KB |
Output is correct |
24 |
Correct |
23 ms |
4696 KB |
Output is correct |
25 |
Correct |
29 ms |
5460 KB |
Output is correct |
26 |
Correct |
46 ms |
5184 KB |
Output is correct |
27 |
Correct |
33 ms |
4960 KB |
Output is correct |
28 |
Correct |
36 ms |
5216 KB |
Output is correct |
29 |
Correct |
32 ms |
4956 KB |
Output is correct |
30 |
Correct |
36 ms |
5564 KB |
Output is correct |
31 |
Correct |
38 ms |
5216 KB |
Output is correct |
32 |
Correct |
37 ms |
5464 KB |
Output is correct |
33 |
Correct |
37 ms |
5212 KB |
Output is correct |
34 |
Correct |
39 ms |
5428 KB |
Output is correct |
35 |
Correct |
24 ms |
4064 KB |
Output is correct |
36 |
Correct |
29 ms |
4192 KB |
Output is correct |
37 |
Correct |
24 ms |
4188 KB |
Output is correct |
38 |
Correct |
19 ms |
3680 KB |
Output is correct |
39 |
Correct |
19 ms |
3548 KB |
Output is correct |
40 |
Correct |
34 ms |
6236 KB |
Output is correct |
41 |
Correct |
19 ms |
3676 KB |
Output is correct |
42 |
Correct |
33 ms |
6360 KB |
Output is correct |
43 |
Correct |
32 ms |
6228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
4700 KB |
Output is correct |
2 |
Correct |
13 ms |
2908 KB |
Output is correct |
3 |
Correct |
11 ms |
2908 KB |
Output is correct |
4 |
Correct |
11 ms |
2804 KB |
Output is correct |
5 |
Correct |
11 ms |
2844 KB |
Output is correct |
6 |
Correct |
11 ms |
2908 KB |
Output is correct |
7 |
Correct |
10 ms |
2908 KB |
Output is correct |
8 |
Correct |
10 ms |
2908 KB |
Output is correct |
9 |
Correct |
11 ms |
2908 KB |
Output is correct |
10 |
Correct |
11 ms |
2908 KB |
Output is correct |
11 |
Correct |
840 ms |
67908 KB |
Output is correct |
12 |
Correct |
10 ms |
2908 KB |
Output is correct |
13 |
Correct |
1268 ms |
67948 KB |
Output is correct |
14 |
Correct |
10 ms |
2908 KB |
Output is correct |
15 |
Correct |
841 ms |
68072 KB |
Output is correct |
16 |
Correct |
885 ms |
67896 KB |
Output is correct |
17 |
Correct |
1266 ms |
67908 KB |
Output is correct |
18 |
Correct |
877 ms |
68324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
3416 KB |
Output is correct |
2 |
Correct |
11 ms |
2908 KB |
Output is correct |
3 |
Correct |
28 ms |
5276 KB |
Output is correct |
4 |
Correct |
25 ms |
5592 KB |
Output is correct |
5 |
Correct |
25 ms |
5592 KB |
Output is correct |
6 |
Correct |
26 ms |
5212 KB |
Output is correct |
7 |
Correct |
34 ms |
5308 KB |
Output is correct |
8 |
Correct |
23 ms |
4700 KB |
Output is correct |
9 |
Correct |
11 ms |
3040 KB |
Output is correct |
10 |
Correct |
21 ms |
4700 KB |
Output is correct |
11 |
Correct |
28 ms |
5580 KB |
Output is correct |
12 |
Correct |
32 ms |
5584 KB |
Output is correct |
13 |
Correct |
10 ms |
2908 KB |
Output is correct |
14 |
Correct |
32 ms |
5656 KB |
Output is correct |
15 |
Correct |
10 ms |
2908 KB |
Output is correct |
16 |
Correct |
33 ms |
5208 KB |
Output is correct |
17 |
Correct |
10 ms |
2908 KB |
Output is correct |
18 |
Correct |
33 ms |
5080 KB |
Output is correct |
19 |
Correct |
23 ms |
4700 KB |
Output is correct |
20 |
Correct |
24 ms |
4952 KB |
Output is correct |
21 |
Correct |
25 ms |
4964 KB |
Output is correct |
22 |
Correct |
23 ms |
4692 KB |
Output is correct |
23 |
Correct |
30 ms |
5416 KB |
Output is correct |
24 |
Correct |
23 ms |
4696 KB |
Output is correct |
25 |
Correct |
29 ms |
5460 KB |
Output is correct |
26 |
Correct |
46 ms |
5184 KB |
Output is correct |
27 |
Correct |
33 ms |
4960 KB |
Output is correct |
28 |
Correct |
36 ms |
5216 KB |
Output is correct |
29 |
Correct |
32 ms |
4956 KB |
Output is correct |
30 |
Correct |
36 ms |
5564 KB |
Output is correct |
31 |
Correct |
38 ms |
5216 KB |
Output is correct |
32 |
Correct |
37 ms |
5464 KB |
Output is correct |
33 |
Correct |
37 ms |
5212 KB |
Output is correct |
34 |
Correct |
39 ms |
5428 KB |
Output is correct |
35 |
Correct |
24 ms |
4064 KB |
Output is correct |
36 |
Correct |
29 ms |
4192 KB |
Output is correct |
37 |
Correct |
24 ms |
4188 KB |
Output is correct |
38 |
Correct |
19 ms |
3680 KB |
Output is correct |
39 |
Correct |
19 ms |
3548 KB |
Output is correct |
40 |
Correct |
34 ms |
6236 KB |
Output is correct |
41 |
Correct |
19 ms |
3676 KB |
Output is correct |
42 |
Correct |
33 ms |
6360 KB |
Output is correct |
43 |
Correct |
32 ms |
6228 KB |
Output is correct |
44 |
Correct |
51 ms |
9044 KB |
Output is correct |
45 |
Correct |
11 ms |
3012 KB |
Output is correct |
46 |
Correct |
34 ms |
6284 KB |
Output is correct |
47 |
Correct |
71 ms |
8884 KB |
Output is correct |
48 |
Correct |
46 ms |
6236 KB |
Output is correct |
49 |
Correct |
72 ms |
8788 KB |
Output is correct |
50 |
Correct |
71 ms |
8472 KB |
Output is correct |
51 |
Correct |
62 ms |
12628 KB |
Output is correct |
52 |
Correct |
25 ms |
5628 KB |
Output is correct |
53 |
Correct |
131 ms |
16172 KB |
Output is correct |
54 |
Correct |
67 ms |
13400 KB |
Output is correct |
55 |
Correct |
33 ms |
5212 KB |
Output is correct |
56 |
Correct |
27 ms |
5752 KB |
Output is correct |
57 |
Correct |
23 ms |
4700 KB |
Output is correct |
58 |
Correct |
111 ms |
15652 KB |
Output is correct |
59 |
Correct |
29 ms |
5436 KB |
Output is correct |
60 |
Correct |
37 ms |
5212 KB |
Output is correct |
61 |
Correct |
30 ms |
5460 KB |
Output is correct |
62 |
Correct |
187 ms |
5460 KB |
Output is correct |
63 |
Correct |
46 ms |
9556 KB |
Output is correct |
64 |
Execution timed out |
3074 ms |
9044 KB |
Time limit exceeded |
65 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
3416 KB |
Output is correct |
2 |
Correct |
11 ms |
2908 KB |
Output is correct |
3 |
Correct |
28 ms |
5276 KB |
Output is correct |
4 |
Correct |
25 ms |
5592 KB |
Output is correct |
5 |
Correct |
25 ms |
5592 KB |
Output is correct |
6 |
Correct |
26 ms |
5212 KB |
Output is correct |
7 |
Correct |
34 ms |
5308 KB |
Output is correct |
8 |
Correct |
23 ms |
4700 KB |
Output is correct |
9 |
Correct |
11 ms |
3040 KB |
Output is correct |
10 |
Correct |
21 ms |
4700 KB |
Output is correct |
11 |
Correct |
28 ms |
5580 KB |
Output is correct |
12 |
Correct |
32 ms |
5584 KB |
Output is correct |
13 |
Correct |
10 ms |
2908 KB |
Output is correct |
14 |
Correct |
32 ms |
5656 KB |
Output is correct |
15 |
Correct |
10 ms |
2908 KB |
Output is correct |
16 |
Correct |
33 ms |
5208 KB |
Output is correct |
17 |
Correct |
10 ms |
2908 KB |
Output is correct |
18 |
Correct |
33 ms |
5080 KB |
Output is correct |
19 |
Correct |
23 ms |
4700 KB |
Output is correct |
20 |
Correct |
24 ms |
4952 KB |
Output is correct |
21 |
Correct |
25 ms |
4964 KB |
Output is correct |
22 |
Correct |
23 ms |
4692 KB |
Output is correct |
23 |
Correct |
30 ms |
5416 KB |
Output is correct |
24 |
Correct |
23 ms |
4696 KB |
Output is correct |
25 |
Correct |
29 ms |
5460 KB |
Output is correct |
26 |
Correct |
46 ms |
5184 KB |
Output is correct |
27 |
Correct |
33 ms |
4960 KB |
Output is correct |
28 |
Correct |
36 ms |
5216 KB |
Output is correct |
29 |
Correct |
32 ms |
4956 KB |
Output is correct |
30 |
Correct |
36 ms |
5564 KB |
Output is correct |
31 |
Correct |
38 ms |
5216 KB |
Output is correct |
32 |
Correct |
37 ms |
5464 KB |
Output is correct |
33 |
Correct |
37 ms |
5212 KB |
Output is correct |
34 |
Correct |
39 ms |
5428 KB |
Output is correct |
35 |
Correct |
24 ms |
4064 KB |
Output is correct |
36 |
Correct |
29 ms |
4192 KB |
Output is correct |
37 |
Correct |
24 ms |
4188 KB |
Output is correct |
38 |
Correct |
19 ms |
3680 KB |
Output is correct |
39 |
Correct |
19 ms |
3548 KB |
Output is correct |
40 |
Correct |
34 ms |
6236 KB |
Output is correct |
41 |
Correct |
19 ms |
3676 KB |
Output is correct |
42 |
Correct |
33 ms |
6360 KB |
Output is correct |
43 |
Correct |
32 ms |
6228 KB |
Output is correct |
44 |
Correct |
10 ms |
2908 KB |
Output is correct |
45 |
Correct |
347 ms |
49964 KB |
Output is correct |
46 |
Correct |
383 ms |
29052 KB |
Output is correct |
47 |
Correct |
348 ms |
50344 KB |
Output is correct |
48 |
Correct |
365 ms |
50032 KB |
Output is correct |
49 |
Correct |
190 ms |
26692 KB |
Output is correct |
50 |
Correct |
542 ms |
46848 KB |
Output is correct |
51 |
Correct |
616 ms |
50404 KB |
Output is correct |
52 |
Correct |
268 ms |
26448 KB |
Output is correct |
53 |
Correct |
194 ms |
26688 KB |
Output is correct |
54 |
Correct |
175 ms |
20952 KB |
Output is correct |
55 |
Correct |
595 ms |
48092 KB |
Output is correct |
56 |
Correct |
177 ms |
22796 KB |
Output is correct |
57 |
Correct |
274 ms |
26428 KB |
Output is correct |
58 |
Correct |
218 ms |
26636 KB |
Output is correct |
59 |
Correct |
172 ms |
22828 KB |
Output is correct |
60 |
Correct |
246 ms |
22888 KB |
Output is correct |
61 |
Correct |
218 ms |
26656 KB |
Output is correct |
62 |
Correct |
322 ms |
24636 KB |
Output is correct |
63 |
Correct |
283 ms |
35092 KB |
Output is correct |
64 |
Correct |
221 ms |
22824 KB |
Output is correct |
65 |
Correct |
406 ms |
43048 KB |
Output is correct |
66 |
Correct |
322 ms |
24788 KB |
Output is correct |
67 |
Correct |
292 ms |
35092 KB |
Output is correct |
68 |
Correct |
494 ms |
41124 KB |
Output is correct |
69 |
Correct |
330 ms |
43096 KB |
Output is correct |
70 |
Correct |
277 ms |
24560 KB |
Output is correct |
71 |
Correct |
483 ms |
41060 KB |
Output is correct |
72 |
Correct |
391 ms |
30364 KB |
Output is correct |
73 |
Correct |
528 ms |
48360 KB |
Output is correct |
74 |
Correct |
268 ms |
24640 KB |
Output is correct |
75 |
Correct |
198 ms |
19096 KB |
Output is correct |
76 |
Correct |
377 ms |
30828 KB |
Output is correct |
77 |
Correct |
534 ms |
48224 KB |
Output is correct |
78 |
Correct |
243 ms |
25620 KB |
Output is correct |
79 |
Correct |
186 ms |
18904 KB |
Output is correct |
80 |
Correct |
90 ms |
11096 KB |
Output is correct |
81 |
Correct |
255 ms |
25656 KB |
Output is correct |
82 |
Correct |
390 ms |
28480 KB |
Output is correct |
83 |
Correct |
100 ms |
11348 KB |
Output is correct |
84 |
Correct |
376 ms |
28488 KB |
Output is correct |