#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
const int ms = 4e5+5;
vector<int> g[ms];
main() {
cin.tie(0); ios::sync_with_stdio(0);
int n, k;
cin >> n >> k;
for (int i = 0; i < n; i++) {
int d;
cin >> d;
g[i].resize(d);
for(int j = 0; j < d; j++) {
cin >> g[i][j];
}
}
int ans = 1;
for(int i = 0; i < n; i++) {
if(g[i].size() > 0) ans = max(ans, 2);
set<int> s;
for(int j : g[i]) {
for(int k : g[j]) {
if(s.count(k)) ans = max(ans, 3);
}
s.insert(j);
}
}
cout << ans << '\n';
}
Compilation message
politicaldevelopment.cpp:10:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main() {
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
9848 KB |
Output is correct |
2 |
Correct |
10 ms |
9848 KB |
Output is correct |
3 |
Correct |
13 ms |
9976 KB |
Output is correct |
4 |
Correct |
36 ms |
10232 KB |
Output is correct |
5 |
Correct |
36 ms |
10360 KB |
Output is correct |
6 |
Correct |
13 ms |
9976 KB |
Output is correct |
7 |
Correct |
13 ms |
9976 KB |
Output is correct |
8 |
Correct |
10 ms |
9720 KB |
Output is correct |
9 |
Correct |
10 ms |
9720 KB |
Output is correct |
10 |
Correct |
11 ms |
9768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
9848 KB |
Output is correct |
2 |
Correct |
10 ms |
9848 KB |
Output is correct |
3 |
Correct |
13 ms |
9976 KB |
Output is correct |
4 |
Correct |
36 ms |
10232 KB |
Output is correct |
5 |
Correct |
36 ms |
10360 KB |
Output is correct |
6 |
Correct |
13 ms |
9976 KB |
Output is correct |
7 |
Correct |
13 ms |
9976 KB |
Output is correct |
8 |
Correct |
10 ms |
9720 KB |
Output is correct |
9 |
Correct |
10 ms |
9720 KB |
Output is correct |
10 |
Correct |
11 ms |
9768 KB |
Output is correct |
11 |
Correct |
36 ms |
10232 KB |
Output is correct |
12 |
Correct |
36 ms |
10208 KB |
Output is correct |
13 |
Correct |
10 ms |
9720 KB |
Output is correct |
14 |
Correct |
36 ms |
10360 KB |
Output is correct |
15 |
Correct |
10 ms |
9720 KB |
Output is correct |
16 |
Correct |
13 ms |
9948 KB |
Output is correct |
17 |
Correct |
10 ms |
9720 KB |
Output is correct |
18 |
Correct |
14 ms |
9976 KB |
Output is correct |
19 |
Correct |
10 ms |
9720 KB |
Output is correct |
20 |
Correct |
12 ms |
9848 KB |
Output is correct |
21 |
Correct |
12 ms |
9848 KB |
Output is correct |
22 |
Correct |
11 ms |
9720 KB |
Output is correct |
23 |
Correct |
13 ms |
9976 KB |
Output is correct |
24 |
Correct |
10 ms |
9720 KB |
Output is correct |
25 |
Correct |
14 ms |
9980 KB |
Output is correct |
26 |
Correct |
14 ms |
9976 KB |
Output is correct |
27 |
Correct |
13 ms |
9976 KB |
Output is correct |
28 |
Correct |
14 ms |
9976 KB |
Output is correct |
29 |
Correct |
13 ms |
9976 KB |
Output is correct |
30 |
Correct |
19 ms |
9976 KB |
Output is correct |
31 |
Correct |
14 ms |
9976 KB |
Output is correct |
32 |
Correct |
19 ms |
10108 KB |
Output is correct |
33 |
Correct |
13 ms |
9976 KB |
Output is correct |
34 |
Correct |
14 ms |
9976 KB |
Output is correct |
35 |
Correct |
12 ms |
9848 KB |
Output is correct |
36 |
Correct |
11 ms |
9848 KB |
Output is correct |
37 |
Correct |
12 ms |
9848 KB |
Output is correct |
38 |
Correct |
11 ms |
9720 KB |
Output is correct |
39 |
Correct |
12 ms |
9848 KB |
Output is correct |
40 |
Correct |
16 ms |
9976 KB |
Output is correct |
41 |
Correct |
12 ms |
9752 KB |
Output is correct |
42 |
Correct |
16 ms |
9976 KB |
Output is correct |
43 |
Correct |
16 ms |
9976 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
9720 KB |
Output is correct |
2 |
Correct |
10 ms |
9720 KB |
Output is correct |
3 |
Correct |
10 ms |
9720 KB |
Output is correct |
4 |
Correct |
10 ms |
9720 KB |
Output is correct |
5 |
Incorrect |
10 ms |
9720 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
9848 KB |
Output is correct |
2 |
Correct |
10 ms |
9848 KB |
Output is correct |
3 |
Correct |
13 ms |
9976 KB |
Output is correct |
4 |
Correct |
36 ms |
10232 KB |
Output is correct |
5 |
Correct |
36 ms |
10360 KB |
Output is correct |
6 |
Correct |
13 ms |
9976 KB |
Output is correct |
7 |
Correct |
13 ms |
9976 KB |
Output is correct |
8 |
Correct |
10 ms |
9720 KB |
Output is correct |
9 |
Correct |
10 ms |
9720 KB |
Output is correct |
10 |
Correct |
11 ms |
9768 KB |
Output is correct |
11 |
Correct |
36 ms |
10232 KB |
Output is correct |
12 |
Correct |
36 ms |
10208 KB |
Output is correct |
13 |
Correct |
10 ms |
9720 KB |
Output is correct |
14 |
Correct |
36 ms |
10360 KB |
Output is correct |
15 |
Correct |
10 ms |
9720 KB |
Output is correct |
16 |
Correct |
13 ms |
9948 KB |
Output is correct |
17 |
Correct |
10 ms |
9720 KB |
Output is correct |
18 |
Correct |
14 ms |
9976 KB |
Output is correct |
19 |
Correct |
10 ms |
9720 KB |
Output is correct |
20 |
Correct |
12 ms |
9848 KB |
Output is correct |
21 |
Correct |
12 ms |
9848 KB |
Output is correct |
22 |
Correct |
11 ms |
9720 KB |
Output is correct |
23 |
Correct |
13 ms |
9976 KB |
Output is correct |
24 |
Correct |
10 ms |
9720 KB |
Output is correct |
25 |
Correct |
14 ms |
9980 KB |
Output is correct |
26 |
Correct |
14 ms |
9976 KB |
Output is correct |
27 |
Correct |
13 ms |
9976 KB |
Output is correct |
28 |
Correct |
14 ms |
9976 KB |
Output is correct |
29 |
Correct |
13 ms |
9976 KB |
Output is correct |
30 |
Correct |
19 ms |
9976 KB |
Output is correct |
31 |
Correct |
14 ms |
9976 KB |
Output is correct |
32 |
Correct |
19 ms |
10108 KB |
Output is correct |
33 |
Correct |
13 ms |
9976 KB |
Output is correct |
34 |
Correct |
14 ms |
9976 KB |
Output is correct |
35 |
Correct |
12 ms |
9848 KB |
Output is correct |
36 |
Correct |
11 ms |
9848 KB |
Output is correct |
37 |
Correct |
12 ms |
9848 KB |
Output is correct |
38 |
Correct |
11 ms |
9720 KB |
Output is correct |
39 |
Correct |
12 ms |
9848 KB |
Output is correct |
40 |
Correct |
16 ms |
9976 KB |
Output is correct |
41 |
Correct |
12 ms |
9752 KB |
Output is correct |
42 |
Correct |
16 ms |
9976 KB |
Output is correct |
43 |
Correct |
16 ms |
9976 KB |
Output is correct |
44 |
Incorrect |
24 ms |
10232 KB |
Output isn't correct |
45 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
9848 KB |
Output is correct |
2 |
Correct |
10 ms |
9848 KB |
Output is correct |
3 |
Correct |
13 ms |
9976 KB |
Output is correct |
4 |
Correct |
36 ms |
10232 KB |
Output is correct |
5 |
Correct |
36 ms |
10360 KB |
Output is correct |
6 |
Correct |
13 ms |
9976 KB |
Output is correct |
7 |
Correct |
13 ms |
9976 KB |
Output is correct |
8 |
Correct |
10 ms |
9720 KB |
Output is correct |
9 |
Correct |
10 ms |
9720 KB |
Output is correct |
10 |
Correct |
11 ms |
9768 KB |
Output is correct |
11 |
Correct |
36 ms |
10232 KB |
Output is correct |
12 |
Correct |
36 ms |
10208 KB |
Output is correct |
13 |
Correct |
10 ms |
9720 KB |
Output is correct |
14 |
Correct |
36 ms |
10360 KB |
Output is correct |
15 |
Correct |
10 ms |
9720 KB |
Output is correct |
16 |
Correct |
13 ms |
9948 KB |
Output is correct |
17 |
Correct |
10 ms |
9720 KB |
Output is correct |
18 |
Correct |
14 ms |
9976 KB |
Output is correct |
19 |
Correct |
10 ms |
9720 KB |
Output is correct |
20 |
Correct |
12 ms |
9848 KB |
Output is correct |
21 |
Correct |
12 ms |
9848 KB |
Output is correct |
22 |
Correct |
11 ms |
9720 KB |
Output is correct |
23 |
Correct |
13 ms |
9976 KB |
Output is correct |
24 |
Correct |
10 ms |
9720 KB |
Output is correct |
25 |
Correct |
14 ms |
9980 KB |
Output is correct |
26 |
Correct |
14 ms |
9976 KB |
Output is correct |
27 |
Correct |
13 ms |
9976 KB |
Output is correct |
28 |
Correct |
14 ms |
9976 KB |
Output is correct |
29 |
Correct |
13 ms |
9976 KB |
Output is correct |
30 |
Correct |
19 ms |
9976 KB |
Output is correct |
31 |
Correct |
14 ms |
9976 KB |
Output is correct |
32 |
Correct |
19 ms |
10108 KB |
Output is correct |
33 |
Correct |
13 ms |
9976 KB |
Output is correct |
34 |
Correct |
14 ms |
9976 KB |
Output is correct |
35 |
Correct |
12 ms |
9848 KB |
Output is correct |
36 |
Correct |
11 ms |
9848 KB |
Output is correct |
37 |
Correct |
12 ms |
9848 KB |
Output is correct |
38 |
Correct |
11 ms |
9720 KB |
Output is correct |
39 |
Correct |
12 ms |
9848 KB |
Output is correct |
40 |
Correct |
16 ms |
9976 KB |
Output is correct |
41 |
Correct |
12 ms |
9752 KB |
Output is correct |
42 |
Correct |
16 ms |
9976 KB |
Output is correct |
43 |
Correct |
16 ms |
9976 KB |
Output is correct |
44 |
Correct |
10 ms |
9724 KB |
Output is correct |
45 |
Incorrect |
125 ms |
13412 KB |
Output isn't correct |
46 |
Halted |
0 ms |
0 KB |
- |