Submission #896056

# Submission time Handle Problem Language Result Execution time Memory
896056 2023-12-31T15:02:25 Z pcc Political Development (BOI17_politicaldevelopment) C++14
4 / 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]>=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 1624 KB Output is correct
2 Correct 1 ms 1880 KB Output is correct
3 Correct 2 ms 1628 KB Output is correct
4 Correct 2 ms 1608 KB Output is correct
5 Correct 2 ms 1628 KB Output is correct
6 Correct 2 ms 1628 KB Output is correct
7 Correct 3 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 1 ms 1628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1624 KB Output is correct
2 Correct 1 ms 1880 KB Output is correct
3 Correct 2 ms 1628 KB Output is correct
4 Correct 2 ms 1608 KB Output is correct
5 Correct 2 ms 1628 KB Output is correct
6 Correct 2 ms 1628 KB Output is correct
7 Correct 3 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 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 1624 KB Output is correct
14 Correct 3 ms 1628 KB Output is correct
15 Correct 1 ms 1636 KB Output is correct
16 Correct 3 ms 1624 KB Output is correct
17 Correct 1 ms 1628 KB Output is correct
18 Correct 2 ms 1628 KB Output is correct
19 Correct 1 ms 1628 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 Incorrect 3 ms 1628 KB Output isn't correct
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1628 KB Output is correct
2 Correct 1 ms 1624 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 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 1628 KB Output is correct
11 Execution timed out 3040 ms 5460 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1624 KB Output is correct
2 Correct 1 ms 1880 KB Output is correct
3 Correct 2 ms 1628 KB Output is correct
4 Correct 2 ms 1608 KB Output is correct
5 Correct 2 ms 1628 KB Output is correct
6 Correct 2 ms 1628 KB Output is correct
7 Correct 3 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 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 1624 KB Output is correct
14 Correct 3 ms 1628 KB Output is correct
15 Correct 1 ms 1636 KB Output is correct
16 Correct 3 ms 1624 KB Output is correct
17 Correct 1 ms 1628 KB Output is correct
18 Correct 2 ms 1628 KB Output is correct
19 Correct 1 ms 1628 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 Incorrect 3 ms 1628 KB Output isn't correct
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1624 KB Output is correct
2 Correct 1 ms 1880 KB Output is correct
3 Correct 2 ms 1628 KB Output is correct
4 Correct 2 ms 1608 KB Output is correct
5 Correct 2 ms 1628 KB Output is correct
6 Correct 2 ms 1628 KB Output is correct
7 Correct 3 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 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 1624 KB Output is correct
14 Correct 3 ms 1628 KB Output is correct
15 Correct 1 ms 1636 KB Output is correct
16 Correct 3 ms 1624 KB Output is correct
17 Correct 1 ms 1628 KB Output is correct
18 Correct 2 ms 1628 KB Output is correct
19 Correct 1 ms 1628 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 Incorrect 3 ms 1628 KB Output isn't correct
24 Halted 0 ms 0 KB -