#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
const int N = 5e4;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, k, c, ans;
vector<int> vt, adj[N];
set<int> st[N];
bitset<N> bt[N], r, toTake;
void clean(int x) {
for (int i = 0; i < n; i++) {
if (adj[i].size()+1 < x) r[i] = 1;
}
}
void dfs(int x) {
c++;
if (c > ans) {
ans = c;
clean(c+1);
}
vector<int> opt;
for (int y = toTake._Find_first(); y < n; y = toTake._Find_next(y)) {
if (r[y]) continue;
opt.push_back(y);
}
int sz = opt.size();
if (!sz) return;
int y = opt[rng() % sz];
toTake &= bt[y];
dfs(y);
}
signed main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n >> k;
for (int i = 0; i < n; i++) {
int x; cin >> x;
for (int j = 0; j < x; j++) {
int y; cin >> y;
st[i].insert(y);
if (st[y].find(i) != st[y].end()) {
bt[i][y] = 1;
adj[i].push_back(y);
bt[y][i] = 1;
adj[y].push_back(i);
}
}
}
ans = 1;
for (int i = 0; i < n; i++) {
c = 0;
toTake = bt[i];
dfs(i);
}
cout << ans << "\n";
}
Compilation message
politicaldevelopment.cpp: In function 'void clean(int)':
politicaldevelopment.cpp:19:25: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
19 | if (adj[i].size()+1 < x) r[i] = 1;
| ~~~~~~~~~~~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
Output is correct |
2 |
Correct |
2 ms |
3992 KB |
Output is correct |
3 |
Correct |
23 ms |
25320 KB |
Output is correct |
4 |
Correct |
19 ms |
24664 KB |
Output is correct |
5 |
Correct |
19 ms |
24772 KB |
Output is correct |
6 |
Correct |
19 ms |
24668 KB |
Output is correct |
7 |
Correct |
18 ms |
24668 KB |
Output is correct |
8 |
Correct |
3 ms |
3932 KB |
Output is correct |
9 |
Correct |
2 ms |
3932 KB |
Output is correct |
10 |
Correct |
5 ms |
3932 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
Output is correct |
2 |
Correct |
2 ms |
3992 KB |
Output is correct |
3 |
Correct |
23 ms |
25320 KB |
Output is correct |
4 |
Correct |
19 ms |
24664 KB |
Output is correct |
5 |
Correct |
19 ms |
24772 KB |
Output is correct |
6 |
Correct |
19 ms |
24668 KB |
Output is correct |
7 |
Correct |
18 ms |
24668 KB |
Output is correct |
8 |
Correct |
3 ms |
3932 KB |
Output is correct |
9 |
Correct |
2 ms |
3932 KB |
Output is correct |
10 |
Correct |
5 ms |
3932 KB |
Output is correct |
11 |
Correct |
18 ms |
24664 KB |
Output is correct |
12 |
Correct |
19 ms |
24668 KB |
Output is correct |
13 |
Correct |
2 ms |
3932 KB |
Output is correct |
14 |
Correct |
20 ms |
24668 KB |
Output is correct |
15 |
Correct |
2 ms |
3928 KB |
Output is correct |
16 |
Correct |
17 ms |
24752 KB |
Output is correct |
17 |
Correct |
2 ms |
3932 KB |
Output is correct |
18 |
Correct |
18 ms |
24816 KB |
Output is correct |
19 |
Correct |
3 ms |
3932 KB |
Output is correct |
20 |
Correct |
14 ms |
24412 KB |
Output is correct |
21 |
Correct |
19 ms |
24664 KB |
Output is correct |
22 |
Correct |
4 ms |
3932 KB |
Output is correct |
23 |
Correct |
18 ms |
25872 KB |
Output is correct |
24 |
Correct |
6 ms |
3932 KB |
Output is correct |
25 |
Correct |
19 ms |
25948 KB |
Output is correct |
26 |
Correct |
24 ms |
25176 KB |
Output is correct |
27 |
Correct |
19 ms |
25760 KB |
Output is correct |
28 |
Correct |
19 ms |
25116 KB |
Output is correct |
29 |
Correct |
18 ms |
25692 KB |
Output is correct |
30 |
Correct |
18 ms |
25696 KB |
Output is correct |
31 |
Correct |
20 ms |
26204 KB |
Output is correct |
32 |
Correct |
20 ms |
25632 KB |
Output is correct |
33 |
Correct |
19 ms |
26160 KB |
Output is correct |
34 |
Correct |
19 ms |
25944 KB |
Output is correct |
35 |
Correct |
9 ms |
14676 KB |
Output is correct |
36 |
Correct |
10 ms |
14684 KB |
Output is correct |
37 |
Correct |
11 ms |
14732 KB |
Output is correct |
38 |
Correct |
6 ms |
9332 KB |
Output is correct |
39 |
Correct |
6 ms |
9308 KB |
Output is correct |
40 |
Correct |
20 ms |
26652 KB |
Output is correct |
41 |
Correct |
5 ms |
9308 KB |
Output is correct |
42 |
Correct |
20 ms |
26768 KB |
Output is correct |
43 |
Correct |
23 ms |
26936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
3932 KB |
Output is correct |
2 |
Correct |
2 ms |
3988 KB |
Output is correct |
3 |
Correct |
2 ms |
3992 KB |
Output is correct |
4 |
Correct |
2 ms |
3932 KB |
Output is correct |
5 |
Correct |
2 ms |
3932 KB |
Output is correct |
6 |
Correct |
2 ms |
3932 KB |
Output is correct |
7 |
Correct |
2 ms |
3932 KB |
Output is correct |
8 |
Correct |
2 ms |
3932 KB |
Output is correct |
9 |
Correct |
2 ms |
3932 KB |
Output is correct |
10 |
Correct |
2 ms |
4008 KB |
Output is correct |
11 |
Correct |
334 ms |
337816 KB |
Output is correct |
12 |
Correct |
2 ms |
3928 KB |
Output is correct |
13 |
Correct |
342 ms |
337788 KB |
Output is correct |
14 |
Correct |
2 ms |
3932 KB |
Output is correct |
15 |
Correct |
350 ms |
337764 KB |
Output is correct |
16 |
Correct |
321 ms |
337908 KB |
Output is correct |
17 |
Correct |
328 ms |
337748 KB |
Output is correct |
18 |
Correct |
314 ms |
337748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
Output is correct |
2 |
Correct |
2 ms |
3992 KB |
Output is correct |
3 |
Correct |
23 ms |
25320 KB |
Output is correct |
4 |
Correct |
19 ms |
24664 KB |
Output is correct |
5 |
Correct |
19 ms |
24772 KB |
Output is correct |
6 |
Correct |
19 ms |
24668 KB |
Output is correct |
7 |
Correct |
18 ms |
24668 KB |
Output is correct |
8 |
Correct |
3 ms |
3932 KB |
Output is correct |
9 |
Correct |
2 ms |
3932 KB |
Output is correct |
10 |
Correct |
5 ms |
3932 KB |
Output is correct |
11 |
Correct |
18 ms |
24664 KB |
Output is correct |
12 |
Correct |
19 ms |
24668 KB |
Output is correct |
13 |
Correct |
2 ms |
3932 KB |
Output is correct |
14 |
Correct |
20 ms |
24668 KB |
Output is correct |
15 |
Correct |
2 ms |
3928 KB |
Output is correct |
16 |
Correct |
17 ms |
24752 KB |
Output is correct |
17 |
Correct |
2 ms |
3932 KB |
Output is correct |
18 |
Correct |
18 ms |
24816 KB |
Output is correct |
19 |
Correct |
3 ms |
3932 KB |
Output is correct |
20 |
Correct |
14 ms |
24412 KB |
Output is correct |
21 |
Correct |
19 ms |
24664 KB |
Output is correct |
22 |
Correct |
4 ms |
3932 KB |
Output is correct |
23 |
Correct |
18 ms |
25872 KB |
Output is correct |
24 |
Correct |
6 ms |
3932 KB |
Output is correct |
25 |
Correct |
19 ms |
25948 KB |
Output is correct |
26 |
Correct |
24 ms |
25176 KB |
Output is correct |
27 |
Correct |
19 ms |
25760 KB |
Output is correct |
28 |
Correct |
19 ms |
25116 KB |
Output is correct |
29 |
Correct |
18 ms |
25692 KB |
Output is correct |
30 |
Correct |
18 ms |
25696 KB |
Output is correct |
31 |
Correct |
20 ms |
26204 KB |
Output is correct |
32 |
Correct |
20 ms |
25632 KB |
Output is correct |
33 |
Correct |
19 ms |
26160 KB |
Output is correct |
34 |
Correct |
19 ms |
25944 KB |
Output is correct |
35 |
Correct |
9 ms |
14676 KB |
Output is correct |
36 |
Correct |
10 ms |
14684 KB |
Output is correct |
37 |
Correct |
11 ms |
14732 KB |
Output is correct |
38 |
Correct |
6 ms |
9332 KB |
Output is correct |
39 |
Correct |
6 ms |
9308 KB |
Output is correct |
40 |
Correct |
20 ms |
26652 KB |
Output is correct |
41 |
Correct |
5 ms |
9308 KB |
Output is correct |
42 |
Correct |
20 ms |
26768 KB |
Output is correct |
43 |
Correct |
23 ms |
26936 KB |
Output is correct |
44 |
Correct |
24 ms |
28760 KB |
Output is correct |
45 |
Correct |
2 ms |
3932 KB |
Output is correct |
46 |
Incorrect |
20 ms |
26716 KB |
Output isn't correct |
47 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
Output is correct |
2 |
Correct |
2 ms |
3992 KB |
Output is correct |
3 |
Correct |
23 ms |
25320 KB |
Output is correct |
4 |
Correct |
19 ms |
24664 KB |
Output is correct |
5 |
Correct |
19 ms |
24772 KB |
Output is correct |
6 |
Correct |
19 ms |
24668 KB |
Output is correct |
7 |
Correct |
18 ms |
24668 KB |
Output is correct |
8 |
Correct |
3 ms |
3932 KB |
Output is correct |
9 |
Correct |
2 ms |
3932 KB |
Output is correct |
10 |
Correct |
5 ms |
3932 KB |
Output is correct |
11 |
Correct |
18 ms |
24664 KB |
Output is correct |
12 |
Correct |
19 ms |
24668 KB |
Output is correct |
13 |
Correct |
2 ms |
3932 KB |
Output is correct |
14 |
Correct |
20 ms |
24668 KB |
Output is correct |
15 |
Correct |
2 ms |
3928 KB |
Output is correct |
16 |
Correct |
17 ms |
24752 KB |
Output is correct |
17 |
Correct |
2 ms |
3932 KB |
Output is correct |
18 |
Correct |
18 ms |
24816 KB |
Output is correct |
19 |
Correct |
3 ms |
3932 KB |
Output is correct |
20 |
Correct |
14 ms |
24412 KB |
Output is correct |
21 |
Correct |
19 ms |
24664 KB |
Output is correct |
22 |
Correct |
4 ms |
3932 KB |
Output is correct |
23 |
Correct |
18 ms |
25872 KB |
Output is correct |
24 |
Correct |
6 ms |
3932 KB |
Output is correct |
25 |
Correct |
19 ms |
25948 KB |
Output is correct |
26 |
Correct |
24 ms |
25176 KB |
Output is correct |
27 |
Correct |
19 ms |
25760 KB |
Output is correct |
28 |
Correct |
19 ms |
25116 KB |
Output is correct |
29 |
Correct |
18 ms |
25692 KB |
Output is correct |
30 |
Correct |
18 ms |
25696 KB |
Output is correct |
31 |
Correct |
20 ms |
26204 KB |
Output is correct |
32 |
Correct |
20 ms |
25632 KB |
Output is correct |
33 |
Correct |
19 ms |
26160 KB |
Output is correct |
34 |
Correct |
19 ms |
25944 KB |
Output is correct |
35 |
Correct |
9 ms |
14676 KB |
Output is correct |
36 |
Correct |
10 ms |
14684 KB |
Output is correct |
37 |
Correct |
11 ms |
14732 KB |
Output is correct |
38 |
Correct |
6 ms |
9332 KB |
Output is correct |
39 |
Correct |
6 ms |
9308 KB |
Output is correct |
40 |
Correct |
20 ms |
26652 KB |
Output is correct |
41 |
Correct |
5 ms |
9308 KB |
Output is correct |
42 |
Correct |
20 ms |
26768 KB |
Output is correct |
43 |
Correct |
23 ms |
26936 KB |
Output is correct |
44 |
Correct |
2 ms |
3932 KB |
Output is correct |
45 |
Incorrect |
271 ms |
322756 KB |
Output isn't correct |
46 |
Halted |
0 ms |
0 KB |
- |