#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 5005;
bool adj[MAX_N][MAX_N] = {};
int main() {
int N, K;
cin >> N >> K;
bool good = false;
vector<vector<int>> G(N);
for (int i = 0; i < N; i++) {
int d;
cin >> d;
if (d != 0) {
good = true;
}
G[i].resize(d);
for (int j = 0; j < d; j++) {
cin >> G[i][j];
adj[i][G[i][j]] = true;
}
}
if (K == 3) {
for (int i = 0; i < N; i++)
for (int j : G[i])
for (int k : G[j])
if (adj[i][k]) {
cout << 3 << "\n";
exit(0);
}
}
cout << (good && K >= 2 ? 2 : 1) << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
9 ms |
21588 KB |
Output is correct |
4 |
Correct |
10 ms |
20564 KB |
Output is correct |
5 |
Correct |
12 ms |
20564 KB |
Output is correct |
6 |
Correct |
11 ms |
18256 KB |
Output is correct |
7 |
Correct |
12 ms |
18548 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
9 ms |
21588 KB |
Output is correct |
4 |
Correct |
10 ms |
20564 KB |
Output is correct |
5 |
Correct |
12 ms |
20564 KB |
Output is correct |
6 |
Correct |
11 ms |
18256 KB |
Output is correct |
7 |
Correct |
12 ms |
18548 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
9 ms |
20564 KB |
Output is correct |
12 |
Correct |
34 ms |
20616 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
27 ms |
20564 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
16 ms |
18620 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
13 ms |
18240 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
8 ms |
18260 KB |
Output is correct |
21 |
Correct |
8 ms |
18388 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
14 ms |
23064 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
11 ms |
23304 KB |
Output is correct |
26 |
Correct |
12 ms |
22328 KB |
Output is correct |
27 |
Correct |
10 ms |
23104 KB |
Output is correct |
28 |
Correct |
16 ms |
22164 KB |
Output is correct |
29 |
Correct |
10 ms |
23164 KB |
Output is correct |
30 |
Correct |
17 ms |
22680 KB |
Output is correct |
31 |
Correct |
15 ms |
24000 KB |
Output is correct |
32 |
Correct |
21 ms |
22888 KB |
Output is correct |
33 |
Correct |
15 ms |
24020 KB |
Output is correct |
34 |
Correct |
11 ms |
23964 KB |
Output is correct |
35 |
Correct |
6 ms |
12116 KB |
Output is correct |
36 |
Correct |
6 ms |
12092 KB |
Output is correct |
37 |
Correct |
6 ms |
12156 KB |
Output is correct |
38 |
Correct |
4 ms |
5820 KB |
Output is correct |
39 |
Correct |
3 ms |
5824 KB |
Output is correct |
40 |
Correct |
15 ms |
24504 KB |
Output is correct |
41 |
Correct |
5 ms |
5824 KB |
Output is correct |
42 |
Correct |
16 ms |
24432 KB |
Output is correct |
43 |
Correct |
13 ms |
24532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
9 ms |
21588 KB |
Output is correct |
4 |
Correct |
10 ms |
20564 KB |
Output is correct |
5 |
Correct |
12 ms |
20564 KB |
Output is correct |
6 |
Correct |
11 ms |
18256 KB |
Output is correct |
7 |
Correct |
12 ms |
18548 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
9 ms |
20564 KB |
Output is correct |
12 |
Correct |
34 ms |
20616 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
27 ms |
20564 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
16 ms |
18620 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
13 ms |
18240 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
8 ms |
18260 KB |
Output is correct |
21 |
Correct |
8 ms |
18388 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
14 ms |
23064 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
11 ms |
23304 KB |
Output is correct |
26 |
Correct |
12 ms |
22328 KB |
Output is correct |
27 |
Correct |
10 ms |
23104 KB |
Output is correct |
28 |
Correct |
16 ms |
22164 KB |
Output is correct |
29 |
Correct |
10 ms |
23164 KB |
Output is correct |
30 |
Correct |
17 ms |
22680 KB |
Output is correct |
31 |
Correct |
15 ms |
24000 KB |
Output is correct |
32 |
Correct |
21 ms |
22888 KB |
Output is correct |
33 |
Correct |
15 ms |
24020 KB |
Output is correct |
34 |
Correct |
11 ms |
23964 KB |
Output is correct |
35 |
Correct |
6 ms |
12116 KB |
Output is correct |
36 |
Correct |
6 ms |
12092 KB |
Output is correct |
37 |
Correct |
6 ms |
12156 KB |
Output is correct |
38 |
Correct |
4 ms |
5820 KB |
Output is correct |
39 |
Correct |
3 ms |
5824 KB |
Output is correct |
40 |
Correct |
15 ms |
24504 KB |
Output is correct |
41 |
Correct |
5 ms |
5824 KB |
Output is correct |
42 |
Correct |
16 ms |
24432 KB |
Output is correct |
43 |
Correct |
13 ms |
24532 KB |
Output is correct |
44 |
Incorrect |
20 ms |
25292 KB |
Output isn't correct |
45 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
9 ms |
21588 KB |
Output is correct |
4 |
Correct |
10 ms |
20564 KB |
Output is correct |
5 |
Correct |
12 ms |
20564 KB |
Output is correct |
6 |
Correct |
11 ms |
18256 KB |
Output is correct |
7 |
Correct |
12 ms |
18548 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
9 ms |
20564 KB |
Output is correct |
12 |
Correct |
34 ms |
20616 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
27 ms |
20564 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
16 ms |
18620 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
13 ms |
18240 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
8 ms |
18260 KB |
Output is correct |
21 |
Correct |
8 ms |
18388 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
14 ms |
23064 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
11 ms |
23304 KB |
Output is correct |
26 |
Correct |
12 ms |
22328 KB |
Output is correct |
27 |
Correct |
10 ms |
23104 KB |
Output is correct |
28 |
Correct |
16 ms |
22164 KB |
Output is correct |
29 |
Correct |
10 ms |
23164 KB |
Output is correct |
30 |
Correct |
17 ms |
22680 KB |
Output is correct |
31 |
Correct |
15 ms |
24000 KB |
Output is correct |
32 |
Correct |
21 ms |
22888 KB |
Output is correct |
33 |
Correct |
15 ms |
24020 KB |
Output is correct |
34 |
Correct |
11 ms |
23964 KB |
Output is correct |
35 |
Correct |
6 ms |
12116 KB |
Output is correct |
36 |
Correct |
6 ms |
12092 KB |
Output is correct |
37 |
Correct |
6 ms |
12156 KB |
Output is correct |
38 |
Correct |
4 ms |
5820 KB |
Output is correct |
39 |
Correct |
3 ms |
5824 KB |
Output is correct |
40 |
Correct |
15 ms |
24504 KB |
Output is correct |
41 |
Correct |
5 ms |
5824 KB |
Output is correct |
42 |
Correct |
16 ms |
24432 KB |
Output is correct |
43 |
Correct |
13 ms |
24532 KB |
Output is correct |
44 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
45 |
Halted |
0 ms |
0 KB |
- |