Submission #1115863

# Submission time Handle Problem Language Result Execution time Memory
1115863 2024-11-21T02:55:06 Z BuzzyBeez Political Development (BOI17_politicaldevelopment) C++17
100 / 100
438 ms 316152 KB
#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;
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});
	for (u = 0; u < n; ++u) {
		cin >> sz;
		while (sz--) cin >> v, G[min(u, v)][max(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 = G[small_clique[0]];
			for (int i = 1; i + 1 < sz; ++i) cur &= G[small_clique[i]];
			for (int j = cur._Find_first(); j < n; j = cur._Find_next(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 18 ms 13648 KB Output is correct
4 Correct 8 ms 10576 KB Output is correct
5 Correct 5 ms 13392 KB Output is correct
6 Correct 10 ms 26192 KB Output is correct
7 Correct 23 ms 11600 KB Output is correct
8 Correct 4 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 4 ms 2896 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 18 ms 13648 KB Output is correct
4 Correct 8 ms 10576 KB Output is correct
5 Correct 5 ms 13392 KB Output is correct
6 Correct 10 ms 26192 KB Output is correct
7 Correct 23 ms 11600 KB Output is correct
8 Correct 4 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 4 ms 2896 KB Output is correct
11 Correct 8 ms 5712 KB Output is correct
12 Correct 11 ms 11344 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 11 ms 19536 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 11 ms 31824 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 12 ms 26192 KB Output is correct
19 Correct 3 ms 848 KB Output is correct
20 Correct 10 ms 31736 KB Output is correct
21 Correct 14 ms 31568 KB Output is correct
22 Correct 4 ms 2896 KB Output is correct
23 Correct 12 ms 28240 KB Output is correct
24 Correct 4 ms 3068 KB Output is correct
25 Correct 12 ms 31824 KB Output is correct
26 Correct 11 ms 31824 KB Output is correct
27 Correct 12 ms 31824 KB Output is correct
28 Correct 14 ms 32008 KB Output is correct
29 Correct 21 ms 14840 KB Output is correct
30 Correct 33 ms 13392 KB Output is correct
31 Correct 32 ms 15696 KB Output is correct
32 Correct 18 ms 31824 KB Output is correct
33 Correct 13 ms 31824 KB Output is correct
34 Correct 26 ms 19024 KB Output is correct
35 Correct 8 ms 17232 KB Output is correct
36 Correct 13 ms 8016 KB Output is correct
37 Correct 11 ms 8040 KB Output is correct
38 Correct 7 ms 4092 KB Output is correct
39 Correct 7 ms 4224 KB Output is correct
40 Correct 39 ms 17232 KB Output is correct
41 Correct 9 ms 4348 KB Output is correct
42 Correct 28 ms 17232 KB Output is correct
43 Correct 16 ms 32140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 848 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 2 ms 336 KB Output is correct
6 Correct 1 ms 336 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 Correct 438 ms 267432 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 297 ms 299056 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 293 ms 287220 KB Output is correct
16 Correct 283 ms 288204 KB Output is correct
17 Correct 286 ms 296576 KB Output is correct
18 Correct 281 ms 302772 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 18 ms 13648 KB Output is correct
4 Correct 8 ms 10576 KB Output is correct
5 Correct 5 ms 13392 KB Output is correct
6 Correct 10 ms 26192 KB Output is correct
7 Correct 23 ms 11600 KB Output is correct
8 Correct 4 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 4 ms 2896 KB Output is correct
11 Correct 8 ms 5712 KB Output is correct
12 Correct 11 ms 11344 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 11 ms 19536 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 11 ms 31824 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 12 ms 26192 KB Output is correct
19 Correct 3 ms 848 KB Output is correct
20 Correct 10 ms 31736 KB Output is correct
21 Correct 14 ms 31568 KB Output is correct
22 Correct 4 ms 2896 KB Output is correct
23 Correct 12 ms 28240 KB Output is correct
24 Correct 4 ms 3068 KB Output is correct
25 Correct 12 ms 31824 KB Output is correct
26 Correct 11 ms 31824 KB Output is correct
27 Correct 12 ms 31824 KB Output is correct
28 Correct 14 ms 32008 KB Output is correct
29 Correct 21 ms 14840 KB Output is correct
30 Correct 33 ms 13392 KB Output is correct
31 Correct 32 ms 15696 KB Output is correct
32 Correct 18 ms 31824 KB Output is correct
33 Correct 13 ms 31824 KB Output is correct
34 Correct 26 ms 19024 KB Output is correct
35 Correct 8 ms 17232 KB Output is correct
36 Correct 13 ms 8016 KB Output is correct
37 Correct 11 ms 8040 KB Output is correct
38 Correct 7 ms 4092 KB Output is correct
39 Correct 7 ms 4224 KB Output is correct
40 Correct 39 ms 17232 KB Output is correct
41 Correct 9 ms 4348 KB Output is correct
42 Correct 28 ms 17232 KB Output is correct
43 Correct 16 ms 32140 KB Output is correct
44 Correct 332 ms 41264 KB Output is correct
45 Correct 1 ms 336 KB Output is correct
46 Correct 14 ms 32140 KB Output is correct
47 Correct 22 ms 32908 KB Output is correct
48 Correct 15 ms 32140 KB Output is correct
49 Correct 25 ms 33076 KB Output is correct
50 Correct 24 ms 32908 KB Output is correct
51 Correct 70 ms 34056 KB Output is correct
52 Correct 5 ms 3152 KB Output is correct
53 Correct 36 ms 34160 KB Output is correct
54 Correct 49 ms 34056 KB Output is correct
55 Correct 16 ms 31824 KB Output is correct
56 Correct 7 ms 3152 KB Output is correct
57 Correct 3 ms 848 KB Output is correct
58 Correct 35 ms 30216 KB Output is correct
59 Correct 29 ms 32416 KB Output is correct
60 Correct 11 ms 31824 KB Output is correct
61 Correct 37 ms 32456 KB Output is correct
62 Correct 49 ms 32532 KB Output is correct
63 Correct 337 ms 28564 KB Output is correct
64 Correct 180 ms 35740 KB Output is correct
65 Correct 36 ms 16720 KB Output is correct
66 Correct 32 ms 32464 KB Output is correct
67 Correct 115 ms 33784 KB Output is correct
68 Correct 179 ms 23352 KB Output is correct
69 Correct 28 ms 29008 KB Output is correct
70 Correct 39 ms 24716 KB Output is correct
71 Correct 109 ms 33772 KB Output is correct
72 Correct 92 ms 33084 KB Output is correct
73 Correct 15 ms 31824 KB Output is correct
74 Correct 50 ms 32908 KB Output is correct
75 Correct 67 ms 33280 KB Output is correct
76 Correct 37 ms 22064 KB Output is correct
77 Correct 44 ms 22792 KB Output is correct
78 Correct 22 ms 14672 KB Output is correct
79 Correct 20 ms 10744 KB Output is correct
80 Correct 29 ms 18328 KB Output is correct
81 Correct 32 ms 29152 KB Output is correct
82 Correct 5 ms 8956 KB Output is correct
83 Correct 13 ms 17804 KB Output is correct
84 Correct 29 ms 32908 KB Output is correct
85 Correct 7 ms 3920 KB Output is correct
86 Correct 42 ms 20876 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 18 ms 13648 KB Output is correct
4 Correct 8 ms 10576 KB Output is correct
5 Correct 5 ms 13392 KB Output is correct
6 Correct 10 ms 26192 KB Output is correct
7 Correct 23 ms 11600 KB Output is correct
8 Correct 4 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 4 ms 2896 KB Output is correct
11 Correct 8 ms 5712 KB Output is correct
12 Correct 11 ms 11344 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 11 ms 19536 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 11 ms 31824 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 12 ms 26192 KB Output is correct
19 Correct 3 ms 848 KB Output is correct
20 Correct 10 ms 31736 KB Output is correct
21 Correct 14 ms 31568 KB Output is correct
22 Correct 4 ms 2896 KB Output is correct
23 Correct 12 ms 28240 KB Output is correct
24 Correct 4 ms 3068 KB Output is correct
25 Correct 12 ms 31824 KB Output is correct
26 Correct 11 ms 31824 KB Output is correct
27 Correct 12 ms 31824 KB Output is correct
28 Correct 14 ms 32008 KB Output is correct
29 Correct 21 ms 14840 KB Output is correct
30 Correct 33 ms 13392 KB Output is correct
31 Correct 32 ms 15696 KB Output is correct
32 Correct 18 ms 31824 KB Output is correct
33 Correct 13 ms 31824 KB Output is correct
34 Correct 26 ms 19024 KB Output is correct
35 Correct 8 ms 17232 KB Output is correct
36 Correct 13 ms 8016 KB Output is correct
37 Correct 11 ms 8040 KB Output is correct
38 Correct 7 ms 4092 KB Output is correct
39 Correct 7 ms 4224 KB Output is correct
40 Correct 39 ms 17232 KB Output is correct
41 Correct 9 ms 4348 KB Output is correct
42 Correct 28 ms 17232 KB Output is correct
43 Correct 16 ms 32140 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 255 ms 279504 KB Output is correct
46 Correct 176 ms 258276 KB Output is correct
47 Correct 269 ms 316152 KB Output is correct
48 Correct 343 ms 233208 KB Output is correct
49 Correct 85 ms 199164 KB Output is correct
50 Correct 262 ms 305136 KB Output is correct
51 Correct 284 ms 304888 KB Output is correct
52 Correct 160 ms 172132 KB Output is correct
53 Correct 96 ms 185084 KB Output is correct
54 Correct 24 ms 3804 KB Output is correct
55 Correct 342 ms 291700 KB Output is correct
56 Correct 97 ms 288352 KB Output is correct
57 Correct 144 ms 267124 KB Output is correct
58 Correct 353 ms 192508 KB Output is correct
59 Correct 170 ms 107732 KB Output is correct
60 Correct 138 ms 263812 KB Output is correct
61 Correct 350 ms 195032 KB Output is correct
62 Correct 244 ms 162236 KB Output is correct
63 Correct 258 ms 289404 KB Output is correct
64 Correct 146 ms 152316 KB Output is correct
65 Correct 287 ms 219640 KB Output is correct
66 Correct 252 ms 159104 KB Output is correct
67 Correct 270 ms 195324 KB Output is correct
68 Correct 290 ms 206328 KB Output is correct
69 Correct 259 ms 219640 KB Output is correct
70 Correct 196 ms 196836 KB Output is correct
71 Correct 246 ms 218616 KB Output is correct
72 Correct 193 ms 184380 KB Output is correct
73 Correct 310 ms 229388 KB Output is correct
74 Correct 205 ms 157948 KB Output is correct
75 Correct 89 ms 145344 KB Output is correct
76 Correct 281 ms 194748 KB Output is correct
77 Correct 265 ms 252596 KB Output is correct
78 Correct 118 ms 121852 KB Output is correct
79 Correct 120 ms 103788 KB Output is correct
80 Correct 39 ms 78488 KB Output is correct
81 Correct 160 ms 106208 KB Output is correct
82 Correct 241 ms 259576 KB Output is correct
83 Correct 84 ms 38144 KB Output is correct
84 Correct 300 ms 277500 KB Output is correct