#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,popcnt,lzcnt")
#include <bits/stdc++.h>
using namespace std;
bitset<50001> G[50001], cur, all;
vector<vector<int>> C[2];
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, k, sz, u, v; cin >> n >> k;
for (int i = 0; i < n; ++i) C[1].push_back({i}), G[i][i] = 1, all[i] = 1;
for (u = 0; u < n; ++u) {
cin >> sz;
while (sz--) cin >> v, G[u][v] = 1;
}
vector<int> tmp; int _c, _p;
for (sz = 2; sz <= k; ++sz) {
_c = sz & 1; _p = 1 ^ _c; C[_c].clear();
for (auto small_clique : C[_p]) {
cur = all;
for (int i : small_clique) cur &= G[i];
for (int j = small_clique.back() + 1; j < n; ++j) if (cur[j]) {
tmp = small_clique; tmp.push_back(j);
C[_c].push_back(tmp);
}
}
if (C[_c].empty()) {cout << sz - 1; return 0;}
// cout << sz << "!!" << '\n';
// for (auto clique : C[sz]) {
// for (int i : clique) cout << i << ' ';
// cout << '\n';
// }
}
cout << k;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
17 ms |
31824 KB |
Output is correct |
4 |
Correct |
17 ms |
31988 KB |
Output is correct |
5 |
Correct |
16 ms |
31744 KB |
Output is correct |
6 |
Correct |
16 ms |
31824 KB |
Output is correct |
7 |
Correct |
16 ms |
31824 KB |
Output is correct |
8 |
Correct |
15 ms |
31588 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
15 ms |
31584 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
17 ms |
31824 KB |
Output is correct |
4 |
Correct |
17 ms |
31988 KB |
Output is correct |
5 |
Correct |
16 ms |
31744 KB |
Output is correct |
6 |
Correct |
16 ms |
31824 KB |
Output is correct |
7 |
Correct |
16 ms |
31824 KB |
Output is correct |
8 |
Correct |
15 ms |
31588 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
15 ms |
31584 KB |
Output is correct |
11 |
Correct |
16 ms |
31836 KB |
Output is correct |
12 |
Correct |
28 ms |
31840 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
27 ms |
32008 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
26 ms |
31824 KB |
Output is correct |
17 |
Correct |
1 ms |
504 KB |
Output is correct |
18 |
Correct |
26 ms |
31984 KB |
Output is correct |
19 |
Correct |
15 ms |
31568 KB |
Output is correct |
20 |
Correct |
22 ms |
31568 KB |
Output is correct |
21 |
Correct |
21 ms |
31748 KB |
Output is correct |
22 |
Correct |
15 ms |
31580 KB |
Output is correct |
23 |
Correct |
31 ms |
32000 KB |
Output is correct |
24 |
Correct |
16 ms |
31568 KB |
Output is correct |
25 |
Correct |
29 ms |
32028 KB |
Output is correct |
26 |
Correct |
26 ms |
31824 KB |
Output is correct |
27 |
Correct |
24 ms |
31824 KB |
Output is correct |
28 |
Correct |
26 ms |
31824 KB |
Output is correct |
29 |
Correct |
25 ms |
31824 KB |
Output is correct |
30 |
Correct |
27 ms |
31824 KB |
Output is correct |
31 |
Correct |
30 ms |
31824 KB |
Output is correct |
32 |
Correct |
28 ms |
31824 KB |
Output is correct |
33 |
Correct |
30 ms |
32248 KB |
Output is correct |
34 |
Correct |
34 ms |
32000 KB |
Output is correct |
35 |
Correct |
10 ms |
17232 KB |
Output is correct |
36 |
Correct |
9 ms |
17232 KB |
Output is correct |
37 |
Correct |
10 ms |
17232 KB |
Output is correct |
38 |
Correct |
5 ms |
9208 KB |
Output is correct |
39 |
Correct |
4 ms |
9040 KB |
Output is correct |
40 |
Correct |
33 ms |
32140 KB |
Output is correct |
41 |
Correct |
5 ms |
8952 KB |
Output is correct |
42 |
Correct |
34 ms |
32284 KB |
Output is correct |
43 |
Correct |
37 ms |
32140 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
31568 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
504 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Execution timed out |
3082 ms |
322448 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
17 ms |
31824 KB |
Output is correct |
4 |
Correct |
17 ms |
31988 KB |
Output is correct |
5 |
Correct |
16 ms |
31744 KB |
Output is correct |
6 |
Correct |
16 ms |
31824 KB |
Output is correct |
7 |
Correct |
16 ms |
31824 KB |
Output is correct |
8 |
Correct |
15 ms |
31588 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
15 ms |
31584 KB |
Output is correct |
11 |
Correct |
16 ms |
31836 KB |
Output is correct |
12 |
Correct |
28 ms |
31840 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
27 ms |
32008 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
26 ms |
31824 KB |
Output is correct |
17 |
Correct |
1 ms |
504 KB |
Output is correct |
18 |
Correct |
26 ms |
31984 KB |
Output is correct |
19 |
Correct |
15 ms |
31568 KB |
Output is correct |
20 |
Correct |
22 ms |
31568 KB |
Output is correct |
21 |
Correct |
21 ms |
31748 KB |
Output is correct |
22 |
Correct |
15 ms |
31580 KB |
Output is correct |
23 |
Correct |
31 ms |
32000 KB |
Output is correct |
24 |
Correct |
16 ms |
31568 KB |
Output is correct |
25 |
Correct |
29 ms |
32028 KB |
Output is correct |
26 |
Correct |
26 ms |
31824 KB |
Output is correct |
27 |
Correct |
24 ms |
31824 KB |
Output is correct |
28 |
Correct |
26 ms |
31824 KB |
Output is correct |
29 |
Correct |
25 ms |
31824 KB |
Output is correct |
30 |
Correct |
27 ms |
31824 KB |
Output is correct |
31 |
Correct |
30 ms |
31824 KB |
Output is correct |
32 |
Correct |
28 ms |
31824 KB |
Output is correct |
33 |
Correct |
30 ms |
32248 KB |
Output is correct |
34 |
Correct |
34 ms |
32000 KB |
Output is correct |
35 |
Correct |
10 ms |
17232 KB |
Output is correct |
36 |
Correct |
9 ms |
17232 KB |
Output is correct |
37 |
Correct |
10 ms |
17232 KB |
Output is correct |
38 |
Correct |
5 ms |
9208 KB |
Output is correct |
39 |
Correct |
4 ms |
9040 KB |
Output is correct |
40 |
Correct |
33 ms |
32140 KB |
Output is correct |
41 |
Correct |
5 ms |
8952 KB |
Output is correct |
42 |
Correct |
34 ms |
32284 KB |
Output is correct |
43 |
Correct |
37 ms |
32140 KB |
Output is correct |
44 |
Correct |
528 ms |
41028 KB |
Output is correct |
45 |
Correct |
1 ms |
336 KB |
Output is correct |
46 |
Correct |
35 ms |
32140 KB |
Output is correct |
47 |
Correct |
59 ms |
32908 KB |
Output is correct |
48 |
Correct |
39 ms |
32244 KB |
Output is correct |
49 |
Correct |
52 ms |
32908 KB |
Output is correct |
50 |
Correct |
52 ms |
32828 KB |
Output is correct |
51 |
Correct |
90 ms |
34056 KB |
Output is correct |
52 |
Correct |
15 ms |
31984 KB |
Output is correct |
53 |
Correct |
90 ms |
34056 KB |
Output is correct |
54 |
Correct |
100 ms |
34056 KB |
Output is correct |
55 |
Correct |
31 ms |
32080 KB |
Output is correct |
56 |
Correct |
17 ms |
31836 KB |
Output is correct |
57 |
Correct |
19 ms |
31584 KB |
Output is correct |
58 |
Correct |
95 ms |
34056 KB |
Output is correct |
59 |
Correct |
62 ms |
32456 KB |
Output is correct |
60 |
Correct |
26 ms |
31992 KB |
Output is correct |
61 |
Correct |
64 ms |
32456 KB |
Output is correct |
62 |
Correct |
62 ms |
32452 KB |
Output is correct |
63 |
Correct |
522 ms |
41004 KB |
Output is correct |
64 |
Correct |
294 ms |
35640 KB |
Output is correct |
65 |
Correct |
34 ms |
32080 KB |
Output is correct |
66 |
Correct |
61 ms |
32448 KB |
Output is correct |
67 |
Correct |
165 ms |
33820 KB |
Output is correct |
68 |
Correct |
299 ms |
35732 KB |
Output is correct |
69 |
Correct |
43 ms |
32080 KB |
Output is correct |
70 |
Correct |
64 ms |
32908 KB |
Output is correct |
71 |
Correct |
162 ms |
33744 KB |
Output is correct |
72 |
Correct |
140 ms |
33084 KB |
Output is correct |
73 |
Correct |
28 ms |
31824 KB |
Output is correct |
74 |
Correct |
70 ms |
32908 KB |
Output is correct |
75 |
Correct |
128 ms |
33280 KB |
Output is correct |
76 |
Correct |
38 ms |
32140 KB |
Output is correct |
77 |
Correct |
72 ms |
33000 KB |
Output is correct |
78 |
Correct |
27 ms |
31824 KB |
Output is correct |
79 |
Correct |
24 ms |
17804 KB |
Output is correct |
80 |
Correct |
45 ms |
32396 KB |
Output is correct |
81 |
Correct |
73 ms |
33024 KB |
Output is correct |
82 |
Correct |
5 ms |
9040 KB |
Output is correct |
83 |
Correct |
23 ms |
17880 KB |
Output is correct |
84 |
Correct |
63 ms |
32836 KB |
Output is correct |
85 |
Correct |
5 ms |
9040 KB |
Output is correct |
86 |
Correct |
60 ms |
32908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
17 ms |
31824 KB |
Output is correct |
4 |
Correct |
17 ms |
31988 KB |
Output is correct |
5 |
Correct |
16 ms |
31744 KB |
Output is correct |
6 |
Correct |
16 ms |
31824 KB |
Output is correct |
7 |
Correct |
16 ms |
31824 KB |
Output is correct |
8 |
Correct |
15 ms |
31588 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
15 ms |
31584 KB |
Output is correct |
11 |
Correct |
16 ms |
31836 KB |
Output is correct |
12 |
Correct |
28 ms |
31840 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
27 ms |
32008 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
26 ms |
31824 KB |
Output is correct |
17 |
Correct |
1 ms |
504 KB |
Output is correct |
18 |
Correct |
26 ms |
31984 KB |
Output is correct |
19 |
Correct |
15 ms |
31568 KB |
Output is correct |
20 |
Correct |
22 ms |
31568 KB |
Output is correct |
21 |
Correct |
21 ms |
31748 KB |
Output is correct |
22 |
Correct |
15 ms |
31580 KB |
Output is correct |
23 |
Correct |
31 ms |
32000 KB |
Output is correct |
24 |
Correct |
16 ms |
31568 KB |
Output is correct |
25 |
Correct |
29 ms |
32028 KB |
Output is correct |
26 |
Correct |
26 ms |
31824 KB |
Output is correct |
27 |
Correct |
24 ms |
31824 KB |
Output is correct |
28 |
Correct |
26 ms |
31824 KB |
Output is correct |
29 |
Correct |
25 ms |
31824 KB |
Output is correct |
30 |
Correct |
27 ms |
31824 KB |
Output is correct |
31 |
Correct |
30 ms |
31824 KB |
Output is correct |
32 |
Correct |
28 ms |
31824 KB |
Output is correct |
33 |
Correct |
30 ms |
32248 KB |
Output is correct |
34 |
Correct |
34 ms |
32000 KB |
Output is correct |
35 |
Correct |
10 ms |
17232 KB |
Output is correct |
36 |
Correct |
9 ms |
17232 KB |
Output is correct |
37 |
Correct |
10 ms |
17232 KB |
Output is correct |
38 |
Correct |
5 ms |
9208 KB |
Output is correct |
39 |
Correct |
4 ms |
9040 KB |
Output is correct |
40 |
Correct |
33 ms |
32140 KB |
Output is correct |
41 |
Correct |
5 ms |
8952 KB |
Output is correct |
42 |
Correct |
34 ms |
32284 KB |
Output is correct |
43 |
Correct |
37 ms |
32140 KB |
Output is correct |
44 |
Correct |
1 ms |
336 KB |
Output is correct |
45 |
Correct |
2848 ms |
319336 KB |
Output is correct |
46 |
Correct |
2160 ms |
313880 KB |
Output is correct |
47 |
Correct |
2948 ms |
320248 KB |
Output is correct |
48 |
Correct |
2887 ms |
320560 KB |
Output is correct |
49 |
Correct |
984 ms |
312192 KB |
Output is correct |
50 |
Execution timed out |
3048 ms |
321688 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |