Submission #896063

# Submission time Handle Problem Language Result Execution time Memory
896063 2023-12-31T15:13:19 Z pcc Political Development (BOI17_politicaldevelopment) C++17
16 / 100
3000 ms 5460 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]>11)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 1628 KB Output is correct
2 Correct 1 ms 1628 KB Output is correct
3 Correct 12 ms 1824 KB Output is correct
4 Correct 3 ms 1628 KB Output is correct
5 Correct 3 ms 1628 KB Output is correct
6 Correct 2 ms 1684 KB Output is correct
7 Correct 2 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1628 KB Output is correct
2 Correct 1 ms 1628 KB Output is correct
3 Correct 12 ms 1824 KB Output is correct
4 Correct 3 ms 1628 KB Output is correct
5 Correct 3 ms 1628 KB Output is correct
6 Correct 2 ms 1684 KB Output is correct
7 Correct 2 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 Correct 3 ms 1628 KB Output is correct
12 Correct 3 ms 1628 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 3 ms 1628 KB Output is correct
15 Correct 1 ms 1628 KB Output is correct
16 Correct 3 ms 1628 KB Output is correct
17 Correct 1 ms 1628 KB Output is correct
18 Correct 3 ms 1628 KB Output is correct
19 Correct 1 ms 1628 KB Output is correct
20 Correct 2 ms 1628 KB Output is correct
21 Correct 2 ms 1628 KB Output is correct
22 Correct 1 ms 1624 KB Output is correct
23 Correct 8 ms 1628 KB Output is correct
24 Correct 1 ms 1628 KB Output is correct
25 Correct 8 ms 1628 KB Output is correct
26 Correct 7 ms 1812 KB Output is correct
27 Correct 3 ms 1628 KB Output is correct
28 Correct 7 ms 1812 KB Output is correct
29 Correct 3 ms 1628 KB Output is correct
30 Correct 5 ms 1628 KB Output is correct
31 Correct 7 ms 1628 KB Output is correct
32 Correct 5 ms 1824 KB Output is correct
33 Correct 7 ms 1624 KB Output is correct
34 Correct 6 ms 1628 KB Output is correct
35 Correct 4 ms 1628 KB Output is correct
36 Correct 4 ms 1628 KB Output is correct
37 Correct 4 ms 1628 KB Output is correct
38 Correct 2 ms 1628 KB Output is correct
39 Correct 2 ms 1628 KB Output is correct
40 Correct 61 ms 1628 KB Output is correct
41 Correct 2 ms 1624 KB Output is correct
42 Correct 58 ms 1820 KB Output is correct
43 Correct 57 ms 1624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1824 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 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 3059 ms 5460 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1628 KB Output is correct
2 Correct 1 ms 1628 KB Output is correct
3 Correct 12 ms 1824 KB Output is correct
4 Correct 3 ms 1628 KB Output is correct
5 Correct 3 ms 1628 KB Output is correct
6 Correct 2 ms 1684 KB Output is correct
7 Correct 2 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 Correct 3 ms 1628 KB Output is correct
12 Correct 3 ms 1628 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 3 ms 1628 KB Output is correct
15 Correct 1 ms 1628 KB Output is correct
16 Correct 3 ms 1628 KB Output is correct
17 Correct 1 ms 1628 KB Output is correct
18 Correct 3 ms 1628 KB Output is correct
19 Correct 1 ms 1628 KB Output is correct
20 Correct 2 ms 1628 KB Output is correct
21 Correct 2 ms 1628 KB Output is correct
22 Correct 1 ms 1624 KB Output is correct
23 Correct 8 ms 1628 KB Output is correct
24 Correct 1 ms 1628 KB Output is correct
25 Correct 8 ms 1628 KB Output is correct
26 Correct 7 ms 1812 KB Output is correct
27 Correct 3 ms 1628 KB Output is correct
28 Correct 7 ms 1812 KB Output is correct
29 Correct 3 ms 1628 KB Output is correct
30 Correct 5 ms 1628 KB Output is correct
31 Correct 7 ms 1628 KB Output is correct
32 Correct 5 ms 1824 KB Output is correct
33 Correct 7 ms 1624 KB Output is correct
34 Correct 6 ms 1628 KB Output is correct
35 Correct 4 ms 1628 KB Output is correct
36 Correct 4 ms 1628 KB Output is correct
37 Correct 4 ms 1628 KB Output is correct
38 Correct 2 ms 1628 KB Output is correct
39 Correct 2 ms 1628 KB Output is correct
40 Correct 61 ms 1628 KB Output is correct
41 Correct 2 ms 1624 KB Output is correct
42 Correct 58 ms 1820 KB Output is correct
43 Correct 57 ms 1624 KB Output is correct
44 Correct 490 ms 1884 KB Output is correct
45 Correct 1 ms 1628 KB Output is correct
46 Correct 63 ms 1824 KB Output is correct
47 Incorrect 204 ms 1884 KB Output isn't correct
48 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1628 KB Output is correct
2 Correct 1 ms 1628 KB Output is correct
3 Correct 12 ms 1824 KB Output is correct
4 Correct 3 ms 1628 KB Output is correct
5 Correct 3 ms 1628 KB Output is correct
6 Correct 2 ms 1684 KB Output is correct
7 Correct 2 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 Correct 3 ms 1628 KB Output is correct
12 Correct 3 ms 1628 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 3 ms 1628 KB Output is correct
15 Correct 1 ms 1628 KB Output is correct
16 Correct 3 ms 1628 KB Output is correct
17 Correct 1 ms 1628 KB Output is correct
18 Correct 3 ms 1628 KB Output is correct
19 Correct 1 ms 1628 KB Output is correct
20 Correct 2 ms 1628 KB Output is correct
21 Correct 2 ms 1628 KB Output is correct
22 Correct 1 ms 1624 KB Output is correct
23 Correct 8 ms 1628 KB Output is correct
24 Correct 1 ms 1628 KB Output is correct
25 Correct 8 ms 1628 KB Output is correct
26 Correct 7 ms 1812 KB Output is correct
27 Correct 3 ms 1628 KB Output is correct
28 Correct 7 ms 1812 KB Output is correct
29 Correct 3 ms 1628 KB Output is correct
30 Correct 5 ms 1628 KB Output is correct
31 Correct 7 ms 1628 KB Output is correct
32 Correct 5 ms 1824 KB Output is correct
33 Correct 7 ms 1624 KB Output is correct
34 Correct 6 ms 1628 KB Output is correct
35 Correct 4 ms 1628 KB Output is correct
36 Correct 4 ms 1628 KB Output is correct
37 Correct 4 ms 1628 KB Output is correct
38 Correct 2 ms 1628 KB Output is correct
39 Correct 2 ms 1628 KB Output is correct
40 Correct 61 ms 1628 KB Output is correct
41 Correct 2 ms 1624 KB Output is correct
42 Correct 58 ms 1820 KB Output is correct
43 Correct 57 ms 1624 KB Output is correct
44 Correct 1 ms 1628 KB Output is correct
45 Incorrect 1384 ms 4144 KB Output isn't correct
46 Halted 0 ms 0 KB -