//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ve vector
typedef long long ll;
const int MAXN = 5000;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k, d, a;
bool r2, r3;
vector<bitset<MAXN>> G;
cin >> n >> k;
G = vector<bitset<MAXN>>(n);
r2 = false;
for (int i = 0; i < n; i++) {
cin >> d;
for (int j = 0; j < d; j++) {
cin >> a;
G[i].set(a);
r2 = true;
}
}
r3 = false;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (G[i][j] && G[j][i]) {
if ((G[i] & G[j]).any()) {
r3 = true;
}
}
}
}
if (r3) cout << 3 << endl;
else if (r2) cout << 2 << endl;
else cout << 1 << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
18 ms |
3456 KB |
Output is correct |
4 |
Correct |
22 ms |
3456 KB |
Output is correct |
5 |
Correct |
19 ms |
3456 KB |
Output is correct |
6 |
Correct |
20 ms |
3456 KB |
Output is correct |
7 |
Correct |
18 ms |
3456 KB |
Output is correct |
8 |
Correct |
17 ms |
3456 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
20 ms |
3456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
18 ms |
3456 KB |
Output is correct |
4 |
Correct |
22 ms |
3456 KB |
Output is correct |
5 |
Correct |
19 ms |
3456 KB |
Output is correct |
6 |
Correct |
20 ms |
3456 KB |
Output is correct |
7 |
Correct |
18 ms |
3456 KB |
Output is correct |
8 |
Correct |
17 ms |
3456 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
20 ms |
3456 KB |
Output is correct |
11 |
Correct |
18 ms |
3500 KB |
Output is correct |
12 |
Correct |
18 ms |
3456 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
18 ms |
3456 KB |
Output is correct |
15 |
Correct |
4 ms |
256 KB |
Output is correct |
16 |
Correct |
19 ms |
3456 KB |
Output is correct |
17 |
Correct |
4 ms |
384 KB |
Output is correct |
18 |
Correct |
18 ms |
3456 KB |
Output is correct |
19 |
Correct |
18 ms |
3456 KB |
Output is correct |
20 |
Correct |
20 ms |
3456 KB |
Output is correct |
21 |
Correct |
18 ms |
3456 KB |
Output is correct |
22 |
Correct |
17 ms |
3456 KB |
Output is correct |
23 |
Correct |
19 ms |
3456 KB |
Output is correct |
24 |
Correct |
18 ms |
3456 KB |
Output is correct |
25 |
Correct |
20 ms |
3456 KB |
Output is correct |
26 |
Correct |
19 ms |
3456 KB |
Output is correct |
27 |
Correct |
19 ms |
3456 KB |
Output is correct |
28 |
Correct |
18 ms |
3456 KB |
Output is correct |
29 |
Correct |
19 ms |
3456 KB |
Output is correct |
30 |
Correct |
20 ms |
3456 KB |
Output is correct |
31 |
Correct |
20 ms |
3456 KB |
Output is correct |
32 |
Correct |
19 ms |
3456 KB |
Output is correct |
33 |
Correct |
21 ms |
3584 KB |
Output is correct |
34 |
Correct |
21 ms |
3456 KB |
Output is correct |
35 |
Correct |
9 ms |
2048 KB |
Output is correct |
36 |
Correct |
9 ms |
1920 KB |
Output is correct |
37 |
Correct |
9 ms |
1920 KB |
Output is correct |
38 |
Correct |
7 ms |
1152 KB |
Output is correct |
39 |
Correct |
6 ms |
1152 KB |
Output is correct |
40 |
Correct |
20 ms |
3456 KB |
Output is correct |
41 |
Correct |
6 ms |
1152 KB |
Output is correct |
42 |
Correct |
21 ms |
3456 KB |
Output is correct |
43 |
Correct |
20 ms |
3456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
3456 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
18 ms |
3456 KB |
Output is correct |
4 |
Correct |
22 ms |
3456 KB |
Output is correct |
5 |
Correct |
19 ms |
3456 KB |
Output is correct |
6 |
Correct |
20 ms |
3456 KB |
Output is correct |
7 |
Correct |
18 ms |
3456 KB |
Output is correct |
8 |
Correct |
17 ms |
3456 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
20 ms |
3456 KB |
Output is correct |
11 |
Correct |
18 ms |
3500 KB |
Output is correct |
12 |
Correct |
18 ms |
3456 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
18 ms |
3456 KB |
Output is correct |
15 |
Correct |
4 ms |
256 KB |
Output is correct |
16 |
Correct |
19 ms |
3456 KB |
Output is correct |
17 |
Correct |
4 ms |
384 KB |
Output is correct |
18 |
Correct |
18 ms |
3456 KB |
Output is correct |
19 |
Correct |
18 ms |
3456 KB |
Output is correct |
20 |
Correct |
20 ms |
3456 KB |
Output is correct |
21 |
Correct |
18 ms |
3456 KB |
Output is correct |
22 |
Correct |
17 ms |
3456 KB |
Output is correct |
23 |
Correct |
19 ms |
3456 KB |
Output is correct |
24 |
Correct |
18 ms |
3456 KB |
Output is correct |
25 |
Correct |
20 ms |
3456 KB |
Output is correct |
26 |
Correct |
19 ms |
3456 KB |
Output is correct |
27 |
Correct |
19 ms |
3456 KB |
Output is correct |
28 |
Correct |
18 ms |
3456 KB |
Output is correct |
29 |
Correct |
19 ms |
3456 KB |
Output is correct |
30 |
Correct |
20 ms |
3456 KB |
Output is correct |
31 |
Correct |
20 ms |
3456 KB |
Output is correct |
32 |
Correct |
19 ms |
3456 KB |
Output is correct |
33 |
Correct |
21 ms |
3584 KB |
Output is correct |
34 |
Correct |
21 ms |
3456 KB |
Output is correct |
35 |
Correct |
9 ms |
2048 KB |
Output is correct |
36 |
Correct |
9 ms |
1920 KB |
Output is correct |
37 |
Correct |
9 ms |
1920 KB |
Output is correct |
38 |
Correct |
7 ms |
1152 KB |
Output is correct |
39 |
Correct |
6 ms |
1152 KB |
Output is correct |
40 |
Correct |
20 ms |
3456 KB |
Output is correct |
41 |
Correct |
6 ms |
1152 KB |
Output is correct |
42 |
Correct |
21 ms |
3456 KB |
Output is correct |
43 |
Correct |
20 ms |
3456 KB |
Output is correct |
44 |
Incorrect |
24 ms |
3456 KB |
Output isn't correct |
45 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
18 ms |
3456 KB |
Output is correct |
4 |
Correct |
22 ms |
3456 KB |
Output is correct |
5 |
Correct |
19 ms |
3456 KB |
Output is correct |
6 |
Correct |
20 ms |
3456 KB |
Output is correct |
7 |
Correct |
18 ms |
3456 KB |
Output is correct |
8 |
Correct |
17 ms |
3456 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
20 ms |
3456 KB |
Output is correct |
11 |
Correct |
18 ms |
3500 KB |
Output is correct |
12 |
Correct |
18 ms |
3456 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
18 ms |
3456 KB |
Output is correct |
15 |
Correct |
4 ms |
256 KB |
Output is correct |
16 |
Correct |
19 ms |
3456 KB |
Output is correct |
17 |
Correct |
4 ms |
384 KB |
Output is correct |
18 |
Correct |
18 ms |
3456 KB |
Output is correct |
19 |
Correct |
18 ms |
3456 KB |
Output is correct |
20 |
Correct |
20 ms |
3456 KB |
Output is correct |
21 |
Correct |
18 ms |
3456 KB |
Output is correct |
22 |
Correct |
17 ms |
3456 KB |
Output is correct |
23 |
Correct |
19 ms |
3456 KB |
Output is correct |
24 |
Correct |
18 ms |
3456 KB |
Output is correct |
25 |
Correct |
20 ms |
3456 KB |
Output is correct |
26 |
Correct |
19 ms |
3456 KB |
Output is correct |
27 |
Correct |
19 ms |
3456 KB |
Output is correct |
28 |
Correct |
18 ms |
3456 KB |
Output is correct |
29 |
Correct |
19 ms |
3456 KB |
Output is correct |
30 |
Correct |
20 ms |
3456 KB |
Output is correct |
31 |
Correct |
20 ms |
3456 KB |
Output is correct |
32 |
Correct |
19 ms |
3456 KB |
Output is correct |
33 |
Correct |
21 ms |
3584 KB |
Output is correct |
34 |
Correct |
21 ms |
3456 KB |
Output is correct |
35 |
Correct |
9 ms |
2048 KB |
Output is correct |
36 |
Correct |
9 ms |
1920 KB |
Output is correct |
37 |
Correct |
9 ms |
1920 KB |
Output is correct |
38 |
Correct |
7 ms |
1152 KB |
Output is correct |
39 |
Correct |
6 ms |
1152 KB |
Output is correct |
40 |
Correct |
20 ms |
3456 KB |
Output is correct |
41 |
Correct |
6 ms |
1152 KB |
Output is correct |
42 |
Correct |
21 ms |
3456 KB |
Output is correct |
43 |
Correct |
20 ms |
3456 KB |
Output is correct |
44 |
Correct |
5 ms |
384 KB |
Output is correct |
45 |
Runtime error |
61 ms |
63196 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
46 |
Halted |
0 ms |
0 KB |
- |