Submission #896058

# Submission time Handle Problem Language Result Execution time Memory
896058 2023-12-31T15:02:50 Z pcc Political Development (BOI17_politicaldevelopment) C++14
16 / 100
3000 ms 7048 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")

#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 sz[mxn];
int N,K;

inline bool check(vector<int> &tar){
	sort(tar.begin(),tar.end());
	for(auto &i:tar){
		int pre = 0;
		for(auto &j:tar){
			if(j == i)continue;
			auto it = lower_bound(paths[i].begin()+pre,paths[i].end(),j)-paths[i].begin();
			if(it == sz[i]||paths[i][it] != j)return false;
			pre = it;
		}
	}
	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;
		sz[i] = 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++){
		if(sz[i]>K)continue;
		for(int j =0;j<(1<<sz[i]);j++){
			vector<int> tar;
			tar.push_back(i);
			for(int l = 0;l<sz[i];l++){
				if(j&(1<<l))tar.push_back(paths[i][l]);
			}
			if(check(tar))ans = max(ans,__builtin_popcount(j)+1);
		}
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1632 KB Output is correct
2 Correct 1 ms 1628 KB Output is correct
3 Correct 3 ms 1628 KB Output is correct
4 Correct 3 ms 1884 KB Output is correct
5 Correct 3 ms 1884 KB Output is correct
6 Correct 3 ms 1884 KB Output is correct
7 Correct 3 ms 1884 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1632 KB Output is correct
2 Correct 1 ms 1628 KB Output is correct
3 Correct 3 ms 1628 KB Output is correct
4 Correct 3 ms 1884 KB Output is correct
5 Correct 3 ms 1884 KB Output is correct
6 Correct 3 ms 1884 KB Output is correct
7 Correct 3 ms 1884 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 Correct 3 ms 1880 KB Output is correct
12 Correct 4 ms 1880 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 3 ms 1904 KB Output is correct
15 Correct 1 ms 1628 KB Output is correct
16 Correct 3 ms 1884 KB Output is correct
17 Correct 1 ms 1624 KB Output is correct
18 Correct 2 ms 1828 KB Output is correct
19 Correct 1 ms 1624 KB Output is correct
20 Correct 2 ms 1628 KB Output is correct
21 Correct 2 ms 1644 KB Output is correct
22 Correct 2 ms 1628 KB Output is correct
23 Correct 4 ms 1884 KB Output is correct
24 Correct 2 ms 1884 KB Output is correct
25 Correct 4 ms 1884 KB Output is correct
26 Correct 4 ms 1628 KB Output is correct
27 Correct 3 ms 1628 KB Output is correct
28 Correct 4 ms 1820 KB Output is correct
29 Correct 3 ms 1628 KB Output is correct
30 Correct 6 ms 1892 KB Output is correct
31 Correct 6 ms 1896 KB Output is correct
32 Correct 4 ms 1892 KB Output is correct
33 Correct 6 ms 1892 KB Output is correct
34 Correct 4 ms 1896 KB Output is correct
35 Correct 3 ms 1644 KB Output is correct
36 Correct 3 ms 1628 KB Output is correct
37 Correct 3 ms 1640 KB Output is correct
38 Correct 2 ms 1636 KB Output is correct
39 Correct 2 ms 1640 KB Output is correct
40 Correct 4 ms 1896 KB Output is correct
41 Correct 2 ms 1716 KB Output is correct
42 Correct 6 ms 1900 KB Output is correct
43 Correct 4 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1480 KB Output is correct
2 Correct 1 ms 1628 KB Output is correct
3 Correct 1 ms 1628 KB Output is correct
4 Correct 1 ms 1624 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 1624 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 1624 KB Output is correct
11 Execution timed out 3068 ms 7048 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1632 KB Output is correct
2 Correct 1 ms 1628 KB Output is correct
3 Correct 3 ms 1628 KB Output is correct
4 Correct 3 ms 1884 KB Output is correct
5 Correct 3 ms 1884 KB Output is correct
6 Correct 3 ms 1884 KB Output is correct
7 Correct 3 ms 1884 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 Correct 3 ms 1880 KB Output is correct
12 Correct 4 ms 1880 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 3 ms 1904 KB Output is correct
15 Correct 1 ms 1628 KB Output is correct
16 Correct 3 ms 1884 KB Output is correct
17 Correct 1 ms 1624 KB Output is correct
18 Correct 2 ms 1828 KB Output is correct
19 Correct 1 ms 1624 KB Output is correct
20 Correct 2 ms 1628 KB Output is correct
21 Correct 2 ms 1644 KB Output is correct
22 Correct 2 ms 1628 KB Output is correct
23 Correct 4 ms 1884 KB Output is correct
24 Correct 2 ms 1884 KB Output is correct
25 Correct 4 ms 1884 KB Output is correct
26 Correct 4 ms 1628 KB Output is correct
27 Correct 3 ms 1628 KB Output is correct
28 Correct 4 ms 1820 KB Output is correct
29 Correct 3 ms 1628 KB Output is correct
30 Correct 6 ms 1892 KB Output is correct
31 Correct 6 ms 1896 KB Output is correct
32 Correct 4 ms 1892 KB Output is correct
33 Correct 6 ms 1892 KB Output is correct
34 Correct 4 ms 1896 KB Output is correct
35 Correct 3 ms 1644 KB Output is correct
36 Correct 3 ms 1628 KB Output is correct
37 Correct 3 ms 1640 KB Output is correct
38 Correct 2 ms 1636 KB Output is correct
39 Correct 2 ms 1640 KB Output is correct
40 Correct 4 ms 1896 KB Output is correct
41 Correct 2 ms 1716 KB Output is correct
42 Correct 6 ms 1900 KB Output is correct
43 Correct 4 ms 1880 KB Output is correct
44 Correct 513 ms 1884 KB Output is correct
45 Correct 1 ms 1632 KB Output is correct
46 Incorrect 6 ms 1884 KB Output isn't correct
47 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1632 KB Output is correct
2 Correct 1 ms 1628 KB Output is correct
3 Correct 3 ms 1628 KB Output is correct
4 Correct 3 ms 1884 KB Output is correct
5 Correct 3 ms 1884 KB Output is correct
6 Correct 3 ms 1884 KB Output is correct
7 Correct 3 ms 1884 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 Correct 3 ms 1880 KB Output is correct
12 Correct 4 ms 1880 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 3 ms 1904 KB Output is correct
15 Correct 1 ms 1628 KB Output is correct
16 Correct 3 ms 1884 KB Output is correct
17 Correct 1 ms 1624 KB Output is correct
18 Correct 2 ms 1828 KB Output is correct
19 Correct 1 ms 1624 KB Output is correct
20 Correct 2 ms 1628 KB Output is correct
21 Correct 2 ms 1644 KB Output is correct
22 Correct 2 ms 1628 KB Output is correct
23 Correct 4 ms 1884 KB Output is correct
24 Correct 2 ms 1884 KB Output is correct
25 Correct 4 ms 1884 KB Output is correct
26 Correct 4 ms 1628 KB Output is correct
27 Correct 3 ms 1628 KB Output is correct
28 Correct 4 ms 1820 KB Output is correct
29 Correct 3 ms 1628 KB Output is correct
30 Correct 6 ms 1892 KB Output is correct
31 Correct 6 ms 1896 KB Output is correct
32 Correct 4 ms 1892 KB Output is correct
33 Correct 6 ms 1892 KB Output is correct
34 Correct 4 ms 1896 KB Output is correct
35 Correct 3 ms 1644 KB Output is correct
36 Correct 3 ms 1628 KB Output is correct
37 Correct 3 ms 1640 KB Output is correct
38 Correct 2 ms 1636 KB Output is correct
39 Correct 2 ms 1640 KB Output is correct
40 Correct 4 ms 1896 KB Output is correct
41 Correct 2 ms 1716 KB Output is correct
42 Correct 6 ms 1900 KB Output is correct
43 Correct 4 ms 1880 KB Output is correct
44 Correct 1 ms 1628 KB Output is correct
45 Incorrect 60 ms 5940 KB Output isn't correct
46 Halted 0 ms 0 KB -