#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
ll n,k,d[50000];
vector<ll>adj[50000];
vector<vector<bool>>dis(50000,vector<bool>(50000,0));
bool check(vector<ll>v){
for(ll i=0;i<v.size();i++){
for(ll j=i+1;j<v.size();j++){
if(dis[v[i]][v[j]]==false){
return false;
}
}
}
return true;
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin>>n>>k;
for(ll i=0;i<n;i++){
cin>>d[i];
adj[i].resize(d[i]);
for(ll j=0;j<d[i];j++){
cin>>adj[i][j];
dis[i][adj[i][j]]=true;
}
}
ll ans=1;
for(ll i=0;i<n;i++){
if(d[i]<=10){
ll sz=d[i];
ll p=(1ll<<sz);
vector<ll>v;
for(ll j=0;j<p;j++){
for(ll r=0;r<sz;r++){
if(j&(1ll<<r)){
v.pb(adj[i][r]);
}
}
if(check(v)){
ans=max(ans,(ll)v.size()+1);
}
v.clear();
}
}
}
cout<<ans;
}
Compilation message
politicaldevelopment.cpp: In function 'bool check(std::vector<long long int>)':
politicaldevelopment.cpp:16:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
16 | for(ll i=0;i<v.size();i++){
| ~^~~~~~~~~
politicaldevelopment.cpp:17:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | for(ll j=i+1;j<v.size();j++){
| ~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
143 ms |
310356 KB |
Output is correct |
2 |
Correct |
144 ms |
310324 KB |
Output is correct |
3 |
Correct |
148 ms |
310464 KB |
Output is correct |
4 |
Correct |
154 ms |
310456 KB |
Output is correct |
5 |
Correct |
155 ms |
310608 KB |
Output is correct |
6 |
Correct |
145 ms |
310512 KB |
Output is correct |
7 |
Correct |
147 ms |
310612 KB |
Output is correct |
8 |
Correct |
146 ms |
310348 KB |
Output is correct |
9 |
Correct |
143 ms |
310356 KB |
Output is correct |
10 |
Correct |
161 ms |
310320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
143 ms |
310356 KB |
Output is correct |
2 |
Correct |
144 ms |
310324 KB |
Output is correct |
3 |
Correct |
148 ms |
310464 KB |
Output is correct |
4 |
Correct |
154 ms |
310456 KB |
Output is correct |
5 |
Correct |
155 ms |
310608 KB |
Output is correct |
6 |
Correct |
145 ms |
310512 KB |
Output is correct |
7 |
Correct |
147 ms |
310612 KB |
Output is correct |
8 |
Correct |
146 ms |
310348 KB |
Output is correct |
9 |
Correct |
143 ms |
310356 KB |
Output is correct |
10 |
Correct |
161 ms |
310320 KB |
Output is correct |
11 |
Correct |
151 ms |
310608 KB |
Output is correct |
12 |
Correct |
146 ms |
310496 KB |
Output is correct |
13 |
Correct |
140 ms |
310416 KB |
Output is correct |
14 |
Correct |
142 ms |
310608 KB |
Output is correct |
15 |
Correct |
139 ms |
310356 KB |
Output is correct |
16 |
Correct |
160 ms |
310612 KB |
Output is correct |
17 |
Correct |
141 ms |
310356 KB |
Output is correct |
18 |
Correct |
145 ms |
310616 KB |
Output is correct |
19 |
Correct |
141 ms |
310352 KB |
Output is correct |
20 |
Correct |
142 ms |
310612 KB |
Output is correct |
21 |
Correct |
143 ms |
310612 KB |
Output is correct |
22 |
Correct |
140 ms |
310280 KB |
Output is correct |
23 |
Correct |
146 ms |
310648 KB |
Output is correct |
24 |
Correct |
143 ms |
310452 KB |
Output is correct |
25 |
Correct |
151 ms |
310428 KB |
Output is correct |
26 |
Correct |
148 ms |
310416 KB |
Output is correct |
27 |
Correct |
148 ms |
310580 KB |
Output is correct |
28 |
Correct |
148 ms |
310620 KB |
Output is correct |
29 |
Correct |
186 ms |
310608 KB |
Output is correct |
30 |
Correct |
184 ms |
310428 KB |
Output is correct |
31 |
Correct |
187 ms |
310612 KB |
Output is correct |
32 |
Correct |
143 ms |
310608 KB |
Output is correct |
33 |
Correct |
146 ms |
310612 KB |
Output is correct |
34 |
Correct |
147 ms |
310612 KB |
Output is correct |
35 |
Correct |
146 ms |
310432 KB |
Output is correct |
36 |
Correct |
145 ms |
310528 KB |
Output is correct |
37 |
Correct |
143 ms |
310352 KB |
Output is correct |
38 |
Correct |
151 ms |
310608 KB |
Output is correct |
39 |
Correct |
142 ms |
310472 KB |
Output is correct |
40 |
Correct |
159 ms |
310480 KB |
Output is correct |
41 |
Correct |
141 ms |
310300 KB |
Output is correct |
42 |
Correct |
155 ms |
310484 KB |
Output is correct |
43 |
Correct |
156 ms |
310612 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
142 ms |
310352 KB |
Output is correct |
2 |
Correct |
152 ms |
310356 KB |
Output is correct |
3 |
Correct |
142 ms |
310352 KB |
Output is correct |
4 |
Correct |
155 ms |
310364 KB |
Output is correct |
5 |
Correct |
141 ms |
310356 KB |
Output is correct |
6 |
Correct |
141 ms |
310356 KB |
Output is correct |
7 |
Correct |
144 ms |
310324 KB |
Output is correct |
8 |
Correct |
142 ms |
310384 KB |
Output is correct |
9 |
Correct |
141 ms |
310356 KB |
Output is correct |
10 |
Correct |
144 ms |
310344 KB |
Output is correct |
11 |
Correct |
1302 ms |
317144 KB |
Output is correct |
12 |
Correct |
139 ms |
310352 KB |
Output is correct |
13 |
Correct |
1297 ms |
317352 KB |
Output is correct |
14 |
Correct |
141 ms |
310296 KB |
Output is correct |
15 |
Correct |
1307 ms |
317268 KB |
Output is correct |
16 |
Correct |
1316 ms |
317312 KB |
Output is correct |
17 |
Correct |
1327 ms |
317220 KB |
Output is correct |
18 |
Correct |
1334 ms |
317264 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
143 ms |
310356 KB |
Output is correct |
2 |
Correct |
144 ms |
310324 KB |
Output is correct |
3 |
Correct |
148 ms |
310464 KB |
Output is correct |
4 |
Correct |
154 ms |
310456 KB |
Output is correct |
5 |
Correct |
155 ms |
310608 KB |
Output is correct |
6 |
Correct |
145 ms |
310512 KB |
Output is correct |
7 |
Correct |
147 ms |
310612 KB |
Output is correct |
8 |
Correct |
146 ms |
310348 KB |
Output is correct |
9 |
Correct |
143 ms |
310356 KB |
Output is correct |
10 |
Correct |
161 ms |
310320 KB |
Output is correct |
11 |
Correct |
151 ms |
310608 KB |
Output is correct |
12 |
Correct |
146 ms |
310496 KB |
Output is correct |
13 |
Correct |
140 ms |
310416 KB |
Output is correct |
14 |
Correct |
142 ms |
310608 KB |
Output is correct |
15 |
Correct |
139 ms |
310356 KB |
Output is correct |
16 |
Correct |
160 ms |
310612 KB |
Output is correct |
17 |
Correct |
141 ms |
310356 KB |
Output is correct |
18 |
Correct |
145 ms |
310616 KB |
Output is correct |
19 |
Correct |
141 ms |
310352 KB |
Output is correct |
20 |
Correct |
142 ms |
310612 KB |
Output is correct |
21 |
Correct |
143 ms |
310612 KB |
Output is correct |
22 |
Correct |
140 ms |
310280 KB |
Output is correct |
23 |
Correct |
146 ms |
310648 KB |
Output is correct |
24 |
Correct |
143 ms |
310452 KB |
Output is correct |
25 |
Correct |
151 ms |
310428 KB |
Output is correct |
26 |
Correct |
148 ms |
310416 KB |
Output is correct |
27 |
Correct |
148 ms |
310580 KB |
Output is correct |
28 |
Correct |
148 ms |
310620 KB |
Output is correct |
29 |
Correct |
186 ms |
310608 KB |
Output is correct |
30 |
Correct |
184 ms |
310428 KB |
Output is correct |
31 |
Correct |
187 ms |
310612 KB |
Output is correct |
32 |
Correct |
143 ms |
310608 KB |
Output is correct |
33 |
Correct |
146 ms |
310612 KB |
Output is correct |
34 |
Correct |
147 ms |
310612 KB |
Output is correct |
35 |
Correct |
146 ms |
310432 KB |
Output is correct |
36 |
Correct |
145 ms |
310528 KB |
Output is correct |
37 |
Correct |
143 ms |
310352 KB |
Output is correct |
38 |
Correct |
151 ms |
310608 KB |
Output is correct |
39 |
Correct |
142 ms |
310472 KB |
Output is correct |
40 |
Correct |
159 ms |
310480 KB |
Output is correct |
41 |
Correct |
141 ms |
310300 KB |
Output is correct |
42 |
Correct |
155 ms |
310484 KB |
Output is correct |
43 |
Correct |
156 ms |
310612 KB |
Output is correct |
44 |
Correct |
204 ms |
310852 KB |
Output is correct |
45 |
Correct |
138 ms |
310356 KB |
Output is correct |
46 |
Incorrect |
173 ms |
310612 KB |
Output isn't correct |
47 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
143 ms |
310356 KB |
Output is correct |
2 |
Correct |
144 ms |
310324 KB |
Output is correct |
3 |
Correct |
148 ms |
310464 KB |
Output is correct |
4 |
Correct |
154 ms |
310456 KB |
Output is correct |
5 |
Correct |
155 ms |
310608 KB |
Output is correct |
6 |
Correct |
145 ms |
310512 KB |
Output is correct |
7 |
Correct |
147 ms |
310612 KB |
Output is correct |
8 |
Correct |
146 ms |
310348 KB |
Output is correct |
9 |
Correct |
143 ms |
310356 KB |
Output is correct |
10 |
Correct |
161 ms |
310320 KB |
Output is correct |
11 |
Correct |
151 ms |
310608 KB |
Output is correct |
12 |
Correct |
146 ms |
310496 KB |
Output is correct |
13 |
Correct |
140 ms |
310416 KB |
Output is correct |
14 |
Correct |
142 ms |
310608 KB |
Output is correct |
15 |
Correct |
139 ms |
310356 KB |
Output is correct |
16 |
Correct |
160 ms |
310612 KB |
Output is correct |
17 |
Correct |
141 ms |
310356 KB |
Output is correct |
18 |
Correct |
145 ms |
310616 KB |
Output is correct |
19 |
Correct |
141 ms |
310352 KB |
Output is correct |
20 |
Correct |
142 ms |
310612 KB |
Output is correct |
21 |
Correct |
143 ms |
310612 KB |
Output is correct |
22 |
Correct |
140 ms |
310280 KB |
Output is correct |
23 |
Correct |
146 ms |
310648 KB |
Output is correct |
24 |
Correct |
143 ms |
310452 KB |
Output is correct |
25 |
Correct |
151 ms |
310428 KB |
Output is correct |
26 |
Correct |
148 ms |
310416 KB |
Output is correct |
27 |
Correct |
148 ms |
310580 KB |
Output is correct |
28 |
Correct |
148 ms |
310620 KB |
Output is correct |
29 |
Correct |
186 ms |
310608 KB |
Output is correct |
30 |
Correct |
184 ms |
310428 KB |
Output is correct |
31 |
Correct |
187 ms |
310612 KB |
Output is correct |
32 |
Correct |
143 ms |
310608 KB |
Output is correct |
33 |
Correct |
146 ms |
310612 KB |
Output is correct |
34 |
Correct |
147 ms |
310612 KB |
Output is correct |
35 |
Correct |
146 ms |
310432 KB |
Output is correct |
36 |
Correct |
145 ms |
310528 KB |
Output is correct |
37 |
Correct |
143 ms |
310352 KB |
Output is correct |
38 |
Correct |
151 ms |
310608 KB |
Output is correct |
39 |
Correct |
142 ms |
310472 KB |
Output is correct |
40 |
Correct |
159 ms |
310480 KB |
Output is correct |
41 |
Correct |
141 ms |
310300 KB |
Output is correct |
42 |
Correct |
155 ms |
310484 KB |
Output is correct |
43 |
Correct |
156 ms |
310612 KB |
Output is correct |
44 |
Correct |
146 ms |
310404 KB |
Output is correct |
45 |
Incorrect |
553 ms |
315348 KB |
Output isn't correct |
46 |
Halted |
0 ms |
0 KB |
- |