#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 5e4+10;
vector<int> paths[mxn];
int N,K;
inline bool check(vector<int> &tar){
sort(tar.begin(),tar.end());
for(auto &i:tar){
for(auto &j:tar){
if(j == i)continue;
auto it = lower_bound(paths[j].begin(),paths[j].end(),i);
if(it == paths[j].end()||*it != i)return false;
}
}
return true;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>N>>K;
for(int i = 0;i<N;i++){
int c;
cin>>c;
while(c--){
int tmp;
cin>>tmp;
paths[i].push_back(tmp);
}
sort(paths[i].begin(),paths[i].end());
}
int ans = 0;
for(int i = 0;i<N;i++){
for(int j =0;j<(1<<paths[i].size());j++){
vector<int> tar;
tar.push_back(i);
for(int l = 0;l<paths[i].size();l++){
if(j&(1<<l))tar.push_back(paths[i][l]);
}
if(check(tar))ans = max(ans,__builtin_popcount(j)+1);
}
}
cout<<ans;
}
Compilation message
politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:46:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
46 | for(int l = 0;l<paths[i].size();l++){
| ~^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1624 KB |
Output is correct |
2 |
Correct |
1 ms |
1624 KB |
Output is correct |
3 |
Correct |
14 ms |
1628 KB |
Output is correct |
4 |
Correct |
4 ms |
1880 KB |
Output is correct |
5 |
Correct |
4 ms |
1884 KB |
Output is correct |
6 |
Correct |
6 ms |
1784 KB |
Output is correct |
7 |
Correct |
6 ms |
1880 KB |
Output is correct |
8 |
Correct |
1 ms |
1628 KB |
Output is correct |
9 |
Correct |
1 ms |
1628 KB |
Output is correct |
10 |
Correct |
2 ms |
1628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1624 KB |
Output is correct |
2 |
Correct |
1 ms |
1624 KB |
Output is correct |
3 |
Correct |
14 ms |
1628 KB |
Output is correct |
4 |
Correct |
4 ms |
1880 KB |
Output is correct |
5 |
Correct |
4 ms |
1884 KB |
Output is correct |
6 |
Correct |
6 ms |
1784 KB |
Output is correct |
7 |
Correct |
6 ms |
1880 KB |
Output is correct |
8 |
Correct |
1 ms |
1628 KB |
Output is correct |
9 |
Correct |
1 ms |
1628 KB |
Output is correct |
10 |
Correct |
2 ms |
1628 KB |
Output is correct |
11 |
Correct |
4 ms |
1884 KB |
Output is correct |
12 |
Correct |
4 ms |
1884 KB |
Output is correct |
13 |
Correct |
1 ms |
1628 KB |
Output is correct |
14 |
Correct |
5 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1884 KB |
Output is correct |
16 |
Correct |
6 ms |
1884 KB |
Output is correct |
17 |
Correct |
1 ms |
1372 KB |
Output is correct |
18 |
Correct |
6 ms |
1880 KB |
Output is correct |
19 |
Correct |
1 ms |
1624 KB |
Output is correct |
20 |
Correct |
3 ms |
1628 KB |
Output is correct |
21 |
Correct |
2 ms |
1628 KB |
Output is correct |
22 |
Correct |
1 ms |
1628 KB |
Output is correct |
23 |
Correct |
9 ms |
1628 KB |
Output is correct |
24 |
Correct |
1 ms |
1456 KB |
Output is correct |
25 |
Correct |
9 ms |
1628 KB |
Output is correct |
26 |
Correct |
11 ms |
1628 KB |
Output is correct |
27 |
Correct |
4 ms |
1628 KB |
Output is correct |
28 |
Correct |
7 ms |
1884 KB |
Output is correct |
29 |
Correct |
4 ms |
1628 KB |
Output is correct |
30 |
Correct |
5 ms |
1628 KB |
Output is correct |
31 |
Correct |
7 ms |
1796 KB |
Output is correct |
32 |
Correct |
5 ms |
1740 KB |
Output is correct |
33 |
Correct |
8 ms |
1860 KB |
Output is correct |
34 |
Correct |
7 ms |
1860 KB |
Output is correct |
35 |
Correct |
5 ms |
1628 KB |
Output is correct |
36 |
Correct |
5 ms |
1628 KB |
Output is correct |
37 |
Correct |
4 ms |
1628 KB |
Output is correct |
38 |
Execution timed out |
3042 ms |
1628 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1624 KB |
Output is correct |
2 |
Correct |
1 ms |
1628 KB |
Output is correct |
3 |
Correct |
1 ms |
1372 KB |
Output is correct |
4 |
Correct |
1 ms |
1628 KB |
Output is correct |
5 |
Correct |
1 ms |
1628 KB |
Output is correct |
6 |
Correct |
1 ms |
1628 KB |
Output is correct |
7 |
Correct |
1 ms |
1628 KB |
Output is correct |
8 |
Correct |
1 ms |
1628 KB |
Output is correct |
9 |
Correct |
1 ms |
1628 KB |
Output is correct |
10 |
Correct |
1 ms |
1628 KB |
Output is correct |
11 |
Execution timed out |
3061 ms |
8020 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1624 KB |
Output is correct |
2 |
Correct |
1 ms |
1624 KB |
Output is correct |
3 |
Correct |
14 ms |
1628 KB |
Output is correct |
4 |
Correct |
4 ms |
1880 KB |
Output is correct |
5 |
Correct |
4 ms |
1884 KB |
Output is correct |
6 |
Correct |
6 ms |
1784 KB |
Output is correct |
7 |
Correct |
6 ms |
1880 KB |
Output is correct |
8 |
Correct |
1 ms |
1628 KB |
Output is correct |
9 |
Correct |
1 ms |
1628 KB |
Output is correct |
10 |
Correct |
2 ms |
1628 KB |
Output is correct |
11 |
Correct |
4 ms |
1884 KB |
Output is correct |
12 |
Correct |
4 ms |
1884 KB |
Output is correct |
13 |
Correct |
1 ms |
1628 KB |
Output is correct |
14 |
Correct |
5 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1884 KB |
Output is correct |
16 |
Correct |
6 ms |
1884 KB |
Output is correct |
17 |
Correct |
1 ms |
1372 KB |
Output is correct |
18 |
Correct |
6 ms |
1880 KB |
Output is correct |
19 |
Correct |
1 ms |
1624 KB |
Output is correct |
20 |
Correct |
3 ms |
1628 KB |
Output is correct |
21 |
Correct |
2 ms |
1628 KB |
Output is correct |
22 |
Correct |
1 ms |
1628 KB |
Output is correct |
23 |
Correct |
9 ms |
1628 KB |
Output is correct |
24 |
Correct |
1 ms |
1456 KB |
Output is correct |
25 |
Correct |
9 ms |
1628 KB |
Output is correct |
26 |
Correct |
11 ms |
1628 KB |
Output is correct |
27 |
Correct |
4 ms |
1628 KB |
Output is correct |
28 |
Correct |
7 ms |
1884 KB |
Output is correct |
29 |
Correct |
4 ms |
1628 KB |
Output is correct |
30 |
Correct |
5 ms |
1628 KB |
Output is correct |
31 |
Correct |
7 ms |
1796 KB |
Output is correct |
32 |
Correct |
5 ms |
1740 KB |
Output is correct |
33 |
Correct |
8 ms |
1860 KB |
Output is correct |
34 |
Correct |
7 ms |
1860 KB |
Output is correct |
35 |
Correct |
5 ms |
1628 KB |
Output is correct |
36 |
Correct |
5 ms |
1628 KB |
Output is correct |
37 |
Correct |
4 ms |
1628 KB |
Output is correct |
38 |
Execution timed out |
3042 ms |
1628 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1624 KB |
Output is correct |
2 |
Correct |
1 ms |
1624 KB |
Output is correct |
3 |
Correct |
14 ms |
1628 KB |
Output is correct |
4 |
Correct |
4 ms |
1880 KB |
Output is correct |
5 |
Correct |
4 ms |
1884 KB |
Output is correct |
6 |
Correct |
6 ms |
1784 KB |
Output is correct |
7 |
Correct |
6 ms |
1880 KB |
Output is correct |
8 |
Correct |
1 ms |
1628 KB |
Output is correct |
9 |
Correct |
1 ms |
1628 KB |
Output is correct |
10 |
Correct |
2 ms |
1628 KB |
Output is correct |
11 |
Correct |
4 ms |
1884 KB |
Output is correct |
12 |
Correct |
4 ms |
1884 KB |
Output is correct |
13 |
Correct |
1 ms |
1628 KB |
Output is correct |
14 |
Correct |
5 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1884 KB |
Output is correct |
16 |
Correct |
6 ms |
1884 KB |
Output is correct |
17 |
Correct |
1 ms |
1372 KB |
Output is correct |
18 |
Correct |
6 ms |
1880 KB |
Output is correct |
19 |
Correct |
1 ms |
1624 KB |
Output is correct |
20 |
Correct |
3 ms |
1628 KB |
Output is correct |
21 |
Correct |
2 ms |
1628 KB |
Output is correct |
22 |
Correct |
1 ms |
1628 KB |
Output is correct |
23 |
Correct |
9 ms |
1628 KB |
Output is correct |
24 |
Correct |
1 ms |
1456 KB |
Output is correct |
25 |
Correct |
9 ms |
1628 KB |
Output is correct |
26 |
Correct |
11 ms |
1628 KB |
Output is correct |
27 |
Correct |
4 ms |
1628 KB |
Output is correct |
28 |
Correct |
7 ms |
1884 KB |
Output is correct |
29 |
Correct |
4 ms |
1628 KB |
Output is correct |
30 |
Correct |
5 ms |
1628 KB |
Output is correct |
31 |
Correct |
7 ms |
1796 KB |
Output is correct |
32 |
Correct |
5 ms |
1740 KB |
Output is correct |
33 |
Correct |
8 ms |
1860 KB |
Output is correct |
34 |
Correct |
7 ms |
1860 KB |
Output is correct |
35 |
Correct |
5 ms |
1628 KB |
Output is correct |
36 |
Correct |
5 ms |
1628 KB |
Output is correct |
37 |
Correct |
4 ms |
1628 KB |
Output is correct |
38 |
Execution timed out |
3042 ms |
1628 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |