#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll LASTBIT(ll mask){return (mask) & (-mask);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ll mask){return __builtin_ctzll(mask);}
int logOf(ll mask){return 63 - __builtin_clzll(mask);}
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}
template <class T1, class T2>
bool maximize(T1 &a, T2 b){
if (a < b) {a = b; return true;}
return false;
}
template <class T1, class T2>
bool minimize(T1 &a, T2 b){
if (a > b) {a = b; return true;}
return false;
}
template <class T>
void printArr(T container, char separator = ' ', char finish = '\n'){
for(auto item: container) cout << item << separator;
cout << finish;
}
template <class T>
void remove_dup(vector<T> &a){
sort(ALL(a));
a.resize(unique(ALL(a)) - a.begin());
}
const long N = 5e4 + 69;
long n, k;
set<long> graph[N];
namespace Sub5{
bitset<N> g[N];
long solve(){
for(long i = 0; i<n; ++i) for(long j: graph[i]) g[i][j] = 1;
long ans= 1;
set<pair<long, long>> S;
for(long i = 0; i<n; ++i) S.insert({graph[i].size(), i});
while(S.size()){
pair<long,long> u = *S.begin();
S.erase(u);
long i = u.second;
for(long j: graph[i]){
S.erase({graph[j].size(), j});
graph[j].erase(i);
S.insert({graph[j].size(), j});
}
vector<long> dick(ALL(graph[i]));
for(long j = 0; j<MASK(dick.size()); ++j){
vector<long> tits; tits.reserve(dick.size() + 1);
tits.push_back(i);
for(long k = 0; k<dick.size(); ++k) if (GETBIT(j, k)) tits.push_back(dick[k]);
bool check = true;
for(long x = 0; x < tits.size(); ++x)
for(long y = x+1; y<tits.size(); ++y) if (!g[tits[x]][tits[y]]) check = false;
if (check) maximize(ans, tits.size());
}
}
return ans;
}
}
int main(void){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> k;
for(long i= 0; i<n; ++i){
long d; cin >> d;
while(d--){
long j; cin >> j;
graph[i].insert(j);
}
}
cout << Sub5::solve() << "\n";
return 0;
}
Compilation message
politicaldevelopment.cpp: In function 'long int Sub5::solve()':
politicaldevelopment.cpp:77:34: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
77 | for(long k = 0; k<dick.size(); ++k) if (GETBIT(j, k)) tits.push_back(dick[k]);
| ~^~~~~~~~~~~~
politicaldevelopment.cpp:79:35: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
79 | for(long x = 0; x < tits.size(); ++x)
| ~~^~~~~~~~~~~~~
politicaldevelopment.cpp:80:36: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
80 | for(long y = x+1; y<tits.size(); ++y) if (!g[tits[x]][tits[y]]) check = false;
| ~^~~~~~~~~~~~
politicaldevelopment.cpp: In instantiation of 'bool maximize(T1&, T2) [with T1 = long int; T2 = long unsigned int]':
politicaldevelopment.cpp:81:53: required from here
politicaldevelopment.cpp:25:15: warning: comparison of integer expressions of different signedness: 'long int' and 'long unsigned int' [-Wsign-compare]
25 | if (a < b) {a = b; return true;}
| ~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
3672 KB |
Output is correct |
2 |
Correct |
1 ms |
3676 KB |
Output is correct |
3 |
Correct |
13 ms |
35420 KB |
Output is correct |
4 |
Correct |
8 ms |
35280 KB |
Output is correct |
5 |
Correct |
8 ms |
35416 KB |
Output is correct |
6 |
Correct |
9 ms |
35416 KB |
Output is correct |
7 |
Correct |
8 ms |
35420 KB |
Output is correct |
8 |
Correct |
2 ms |
3932 KB |
Output is correct |
9 |
Correct |
1 ms |
3676 KB |
Output is correct |
10 |
Correct |
3 ms |
8028 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
3672 KB |
Output is correct |
2 |
Correct |
1 ms |
3676 KB |
Output is correct |
3 |
Correct |
13 ms |
35420 KB |
Output is correct |
4 |
Correct |
8 ms |
35280 KB |
Output is correct |
5 |
Correct |
8 ms |
35416 KB |
Output is correct |
6 |
Correct |
9 ms |
35416 KB |
Output is correct |
7 |
Correct |
8 ms |
35420 KB |
Output is correct |
8 |
Correct |
2 ms |
3932 KB |
Output is correct |
9 |
Correct |
1 ms |
3676 KB |
Output is correct |
10 |
Correct |
3 ms |
8028 KB |
Output is correct |
11 |
Correct |
10 ms |
35564 KB |
Output is correct |
12 |
Correct |
8 ms |
35420 KB |
Output is correct |
13 |
Correct |
1 ms |
3676 KB |
Output is correct |
14 |
Correct |
9 ms |
35420 KB |
Output is correct |
15 |
Correct |
1 ms |
3676 KB |
Output is correct |
16 |
Correct |
9 ms |
35272 KB |
Output is correct |
17 |
Correct |
1 ms |
3776 KB |
Output is correct |
18 |
Correct |
9 ms |
35456 KB |
Output is correct |
19 |
Correct |
2 ms |
3932 KB |
Output is correct |
20 |
Correct |
7 ms |
35136 KB |
Output is correct |
21 |
Correct |
8 ms |
35164 KB |
Output is correct |
22 |
Correct |
3 ms |
8028 KB |
Output is correct |
23 |
Correct |
10 ms |
35420 KB |
Output is correct |
24 |
Correct |
3 ms |
8028 KB |
Output is correct |
25 |
Correct |
12 ms |
35420 KB |
Output is correct |
26 |
Correct |
10 ms |
35568 KB |
Output is correct |
27 |
Correct |
8 ms |
35420 KB |
Output is correct |
28 |
Correct |
10 ms |
35420 KB |
Output is correct |
29 |
Correct |
8 ms |
35448 KB |
Output is correct |
30 |
Correct |
10 ms |
35676 KB |
Output is correct |
31 |
Correct |
10 ms |
35676 KB |
Output is correct |
32 |
Correct |
10 ms |
35592 KB |
Output is correct |
33 |
Correct |
10 ms |
35676 KB |
Output is correct |
34 |
Correct |
10 ms |
35672 KB |
Output is correct |
35 |
Correct |
5 ms |
20572 KB |
Output is correct |
36 |
Correct |
5 ms |
20572 KB |
Output is correct |
37 |
Correct |
6 ms |
20572 KB |
Output is correct |
38 |
Correct |
4 ms |
12380 KB |
Output is correct |
39 |
Correct |
4 ms |
12380 KB |
Output is correct |
40 |
Correct |
12 ms |
35932 KB |
Output is correct |
41 |
Correct |
4 ms |
12380 KB |
Output is correct |
42 |
Correct |
13 ms |
35928 KB |
Output is correct |
43 |
Correct |
12 ms |
35932 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3932 KB |
Output is correct |
2 |
Correct |
1 ms |
3676 KB |
Output is correct |
3 |
Correct |
1 ms |
3776 KB |
Output is correct |
4 |
Correct |
1 ms |
3676 KB |
Output is correct |
5 |
Correct |
1 ms |
3676 KB |
Output is correct |
6 |
Correct |
1 ms |
3676 KB |
Output is correct |
7 |
Correct |
1 ms |
3676 KB |
Output is correct |
8 |
Correct |
1 ms |
3748 KB |
Output is correct |
9 |
Correct |
1 ms |
3680 KB |
Output is correct |
10 |
Correct |
1 ms |
3684 KB |
Output is correct |
11 |
Correct |
491 ms |
336584 KB |
Output is correct |
12 |
Correct |
1 ms |
3676 KB |
Output is correct |
13 |
Correct |
414 ms |
336404 KB |
Output is correct |
14 |
Correct |
1 ms |
3676 KB |
Output is correct |
15 |
Correct |
420 ms |
336524 KB |
Output is correct |
16 |
Correct |
389 ms |
336468 KB |
Output is correct |
17 |
Correct |
401 ms |
336724 KB |
Output is correct |
18 |
Correct |
392 ms |
336584 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
3672 KB |
Output is correct |
2 |
Correct |
1 ms |
3676 KB |
Output is correct |
3 |
Correct |
13 ms |
35420 KB |
Output is correct |
4 |
Correct |
8 ms |
35280 KB |
Output is correct |
5 |
Correct |
8 ms |
35416 KB |
Output is correct |
6 |
Correct |
9 ms |
35416 KB |
Output is correct |
7 |
Correct |
8 ms |
35420 KB |
Output is correct |
8 |
Correct |
2 ms |
3932 KB |
Output is correct |
9 |
Correct |
1 ms |
3676 KB |
Output is correct |
10 |
Correct |
3 ms |
8028 KB |
Output is correct |
11 |
Correct |
10 ms |
35564 KB |
Output is correct |
12 |
Correct |
8 ms |
35420 KB |
Output is correct |
13 |
Correct |
1 ms |
3676 KB |
Output is correct |
14 |
Correct |
9 ms |
35420 KB |
Output is correct |
15 |
Correct |
1 ms |
3676 KB |
Output is correct |
16 |
Correct |
9 ms |
35272 KB |
Output is correct |
17 |
Correct |
1 ms |
3776 KB |
Output is correct |
18 |
Correct |
9 ms |
35456 KB |
Output is correct |
19 |
Correct |
2 ms |
3932 KB |
Output is correct |
20 |
Correct |
7 ms |
35136 KB |
Output is correct |
21 |
Correct |
8 ms |
35164 KB |
Output is correct |
22 |
Correct |
3 ms |
8028 KB |
Output is correct |
23 |
Correct |
10 ms |
35420 KB |
Output is correct |
24 |
Correct |
3 ms |
8028 KB |
Output is correct |
25 |
Correct |
12 ms |
35420 KB |
Output is correct |
26 |
Correct |
10 ms |
35568 KB |
Output is correct |
27 |
Correct |
8 ms |
35420 KB |
Output is correct |
28 |
Correct |
10 ms |
35420 KB |
Output is correct |
29 |
Correct |
8 ms |
35448 KB |
Output is correct |
30 |
Correct |
10 ms |
35676 KB |
Output is correct |
31 |
Correct |
10 ms |
35676 KB |
Output is correct |
32 |
Correct |
10 ms |
35592 KB |
Output is correct |
33 |
Correct |
10 ms |
35676 KB |
Output is correct |
34 |
Correct |
10 ms |
35672 KB |
Output is correct |
35 |
Correct |
5 ms |
20572 KB |
Output is correct |
36 |
Correct |
5 ms |
20572 KB |
Output is correct |
37 |
Correct |
6 ms |
20572 KB |
Output is correct |
38 |
Correct |
4 ms |
12380 KB |
Output is correct |
39 |
Correct |
4 ms |
12380 KB |
Output is correct |
40 |
Correct |
12 ms |
35932 KB |
Output is correct |
41 |
Correct |
4 ms |
12380 KB |
Output is correct |
42 |
Correct |
13 ms |
35928 KB |
Output is correct |
43 |
Correct |
12 ms |
35932 KB |
Output is correct |
44 |
Correct |
26 ms |
36956 KB |
Output is correct |
45 |
Correct |
1 ms |
3676 KB |
Output is correct |
46 |
Correct |
15 ms |
36028 KB |
Output is correct |
47 |
Correct |
22 ms |
36956 KB |
Output is correct |
48 |
Correct |
18 ms |
35932 KB |
Output is correct |
49 |
Correct |
22 ms |
37060 KB |
Output is correct |
50 |
Correct |
26 ms |
36956 KB |
Output is correct |
51 |
Correct |
81 ms |
39004 KB |
Output is correct |
52 |
Correct |
8 ms |
35420 KB |
Output is correct |
53 |
Correct |
153 ms |
39624 KB |
Output is correct |
54 |
Correct |
159 ms |
39516 KB |
Output is correct |
55 |
Correct |
9 ms |
35416 KB |
Output is correct |
56 |
Correct |
8 ms |
35420 KB |
Output is correct |
57 |
Correct |
2 ms |
3932 KB |
Output is correct |
58 |
Correct |
150 ms |
39576 KB |
Output is correct |
59 |
Correct |
13 ms |
36184 KB |
Output is correct |
60 |
Correct |
9 ms |
35416 KB |
Output is correct |
61 |
Correct |
10 ms |
35932 KB |
Output is correct |
62 |
Correct |
11 ms |
35932 KB |
Output is correct |
63 |
Correct |
27 ms |
36956 KB |
Output is correct |
64 |
Correct |
19 ms |
36700 KB |
Output is correct |
65 |
Correct |
12 ms |
35676 KB |
Output is correct |
66 |
Correct |
11 ms |
35928 KB |
Output is correct |
67 |
Correct |
31 ms |
37468 KB |
Output is correct |
68 |
Correct |
18 ms |
36952 KB |
Output is correct |
69 |
Correct |
12 ms |
35676 KB |
Output is correct |
70 |
Correct |
20 ms |
36696 KB |
Output is correct |
71 |
Correct |
31 ms |
37212 KB |
Output is correct |
72 |
Correct |
27 ms |
37208 KB |
Output is correct |
73 |
Correct |
10 ms |
35280 KB |
Output is correct |
74 |
Correct |
20 ms |
36812 KB |
Output is correct |
75 |
Correct |
28 ms |
37380 KB |
Output is correct |
76 |
Correct |
15 ms |
36188 KB |
Output is correct |
77 |
Correct |
43 ms |
37940 KB |
Output is correct |
78 |
Correct |
8 ms |
35420 KB |
Output is correct |
79 |
Correct |
20 ms |
21852 KB |
Output is correct |
80 |
Correct |
17 ms |
36188 KB |
Output is correct |
81 |
Correct |
42 ms |
37724 KB |
Output is correct |
82 |
Correct |
4 ms |
12380 KB |
Output is correct |
83 |
Correct |
22 ms |
21852 KB |
Output is correct |
84 |
Correct |
27 ms |
37208 KB |
Output is correct |
85 |
Correct |
4 ms |
12572 KB |
Output is correct |
86 |
Correct |
27 ms |
37212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
3672 KB |
Output is correct |
2 |
Correct |
1 ms |
3676 KB |
Output is correct |
3 |
Correct |
13 ms |
35420 KB |
Output is correct |
4 |
Correct |
8 ms |
35280 KB |
Output is correct |
5 |
Correct |
8 ms |
35416 KB |
Output is correct |
6 |
Correct |
9 ms |
35416 KB |
Output is correct |
7 |
Correct |
8 ms |
35420 KB |
Output is correct |
8 |
Correct |
2 ms |
3932 KB |
Output is correct |
9 |
Correct |
1 ms |
3676 KB |
Output is correct |
10 |
Correct |
3 ms |
8028 KB |
Output is correct |
11 |
Correct |
10 ms |
35564 KB |
Output is correct |
12 |
Correct |
8 ms |
35420 KB |
Output is correct |
13 |
Correct |
1 ms |
3676 KB |
Output is correct |
14 |
Correct |
9 ms |
35420 KB |
Output is correct |
15 |
Correct |
1 ms |
3676 KB |
Output is correct |
16 |
Correct |
9 ms |
35272 KB |
Output is correct |
17 |
Correct |
1 ms |
3776 KB |
Output is correct |
18 |
Correct |
9 ms |
35456 KB |
Output is correct |
19 |
Correct |
2 ms |
3932 KB |
Output is correct |
20 |
Correct |
7 ms |
35136 KB |
Output is correct |
21 |
Correct |
8 ms |
35164 KB |
Output is correct |
22 |
Correct |
3 ms |
8028 KB |
Output is correct |
23 |
Correct |
10 ms |
35420 KB |
Output is correct |
24 |
Correct |
3 ms |
8028 KB |
Output is correct |
25 |
Correct |
12 ms |
35420 KB |
Output is correct |
26 |
Correct |
10 ms |
35568 KB |
Output is correct |
27 |
Correct |
8 ms |
35420 KB |
Output is correct |
28 |
Correct |
10 ms |
35420 KB |
Output is correct |
29 |
Correct |
8 ms |
35448 KB |
Output is correct |
30 |
Correct |
10 ms |
35676 KB |
Output is correct |
31 |
Correct |
10 ms |
35676 KB |
Output is correct |
32 |
Correct |
10 ms |
35592 KB |
Output is correct |
33 |
Correct |
10 ms |
35676 KB |
Output is correct |
34 |
Correct |
10 ms |
35672 KB |
Output is correct |
35 |
Correct |
5 ms |
20572 KB |
Output is correct |
36 |
Correct |
5 ms |
20572 KB |
Output is correct |
37 |
Correct |
6 ms |
20572 KB |
Output is correct |
38 |
Correct |
4 ms |
12380 KB |
Output is correct |
39 |
Correct |
4 ms |
12380 KB |
Output is correct |
40 |
Correct |
12 ms |
35932 KB |
Output is correct |
41 |
Correct |
4 ms |
12380 KB |
Output is correct |
42 |
Correct |
13 ms |
35928 KB |
Output is correct |
43 |
Correct |
12 ms |
35932 KB |
Output is correct |
44 |
Correct |
1 ms |
3676 KB |
Output is correct |
45 |
Correct |
235 ms |
328696 KB |
Output is correct |
46 |
Correct |
107 ms |
320596 KB |
Output is correct |
47 |
Correct |
239 ms |
328888 KB |
Output is correct |
48 |
Correct |
240 ms |
328692 KB |
Output is correct |
49 |
Correct |
78 ms |
318120 KB |
Output is correct |
50 |
Correct |
247 ms |
333944 KB |
Output is correct |
51 |
Correct |
220 ms |
328532 KB |
Output is correct |
52 |
Correct |
82 ms |
318032 KB |
Output is correct |
53 |
Correct |
78 ms |
318040 KB |
Output is correct |
54 |
Correct |
15 ms |
7000 KB |
Output is correct |
55 |
Correct |
266 ms |
333936 KB |
Output is correct |
56 |
Correct |
61 ms |
315388 KB |
Output is correct |
57 |
Correct |
81 ms |
318088 KB |
Output is correct |
58 |
Correct |
108 ms |
320920 KB |
Output is correct |
59 |
Correct |
61 ms |
315220 KB |
Output is correct |
60 |
Correct |
60 ms |
315220 KB |
Output is correct |
61 |
Correct |
93 ms |
320592 KB |
Output is correct |
62 |
Correct |
94 ms |
318032 KB |
Output is correct |
63 |
Correct |
144 ms |
321952 KB |
Output is correct |
64 |
Correct |
60 ms |
315460 KB |
Output is correct |
65 |
Correct |
168 ms |
324568 KB |
Output is correct |
66 |
Correct |
78 ms |
317912 KB |
Output is correct |
67 |
Correct |
139 ms |
322100 KB |
Output is correct |
68 |
Correct |
180 ms |
323928 KB |
Output is correct |
69 |
Correct |
168 ms |
324688 KB |
Output is correct |
70 |
Correct |
91 ms |
318136 KB |
Output is correct |
71 |
Correct |
185 ms |
324092 KB |
Output is correct |
72 |
Correct |
135 ms |
321648 KB |
Output is correct |
73 |
Correct |
205 ms |
326224 KB |
Output is correct |
74 |
Correct |
84 ms |
318032 KB |
Output is correct |
75 |
Correct |
77 ms |
164444 KB |
Output is correct |
76 |
Correct |
129 ms |
321664 KB |
Output is correct |
77 |
Correct |
202 ms |
326224 KB |
Output is correct |
78 |
Correct |
85 ms |
166160 KB |
Output is correct |
79 |
Correct |
70 ms |
164436 KB |
Output is correct |
80 |
Correct |
42 ms |
85232 KB |
Output is correct |
81 |
Correct |
85 ms |
166156 KB |
Output is correct |
82 |
Correct |
159 ms |
323408 KB |
Output is correct |
83 |
Correct |
32 ms |
85080 KB |
Output is correct |
84 |
Correct |
159 ms |
323184 KB |
Output is correct |