Submission #162420

# Submission time Handle Problem Language Result Execution time Memory
162420 2019-11-08T08:23:12 Z MvC Political Development (BOI17_politicaldevelopment) C++11
54 / 100
2806 ms 8236 KB
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=5e3+5;
const int mod=1e9+7;
using namespace std;
int n,k,x,i,j,d[nmax],nr,rs;
bitset<nmax>b[nmax],viz;
vector<int>g[nmax],vc,rnd;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	srand(time(0));
	cin>>n>>k;
	for(i=1;i<=n;i++)
	{
		cin>>d[i];
		for(j=1;j<=d[i];j++)
		{
			cin>>x;
			x++;
			b[i][x]=1;
			g[i].pb(x);
		}
	}
	for(i=1;i<=n;i++)rnd.pb(i);
	while(clock()/(double)CLOCKS_PER_SEC<=2.8)
	{
		random_shuffle(rnd.begin(),rnd.end());
		for(int i=0;i<(int)vc.size();i++)viz[vc[i]]=0;
		vc.clear();
		for(i=0;i<n;i++)
		{
			x=rnd[i];
			nr=0;
			for(j=0;j<(int)g[x].size();j++)nr+=viz[g[x][j]];
			if(nr==(int)vc.size())
			{
				vc.pb(x);
				viz[x]=1;
			}
		}
		rs=max(rs,(int)vc.size());
		if(rs==k)break;
	}
	cout<<rs<<endl;
	return 0;
}

Compilation message

politicaldevelopment.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
politicaldevelopment.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 8 ms 3704 KB Output is correct
4 Correct 7 ms 3832 KB Output is correct
5 Correct 7 ms 3832 KB Output is correct
6 Correct 7 ms 3832 KB Output is correct
7 Correct 7 ms 3832 KB Output is correct
8 Correct 2800 ms 580 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 565 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 8 ms 3704 KB Output is correct
4 Correct 7 ms 3832 KB Output is correct
5 Correct 7 ms 3832 KB Output is correct
6 Correct 7 ms 3832 KB Output is correct
7 Correct 7 ms 3832 KB Output is correct
8 Correct 2800 ms 580 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 565 ms 504 KB Output is correct
11 Correct 7 ms 3832 KB Output is correct
12 Correct 2800 ms 3852 KB Output is correct
13 Correct 2800 ms 508 KB Output is correct
14 Correct 2800 ms 3848 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 2800 ms 3864 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 2800 ms 3864 KB Output is correct
19 Correct 2800 ms 584 KB Output is correct
20 Correct 18 ms 3704 KB Output is correct
21 Correct 32 ms 3704 KB Output is correct
22 Correct 2800 ms 604 KB Output is correct
23 Correct 689 ms 3896 KB Output is correct
24 Correct 2800 ms 604 KB Output is correct
25 Correct 128 ms 3960 KB Output is correct
26 Correct 2800 ms 3888 KB Output is correct
27 Correct 2800 ms 3892 KB Output is correct
28 Correct 2800 ms 3884 KB Output is correct
29 Correct 2800 ms 3884 KB Output is correct
30 Correct 2800 ms 3908 KB Output is correct
31 Correct 2800 ms 3900 KB Output is correct
32 Correct 2800 ms 3916 KB Output is correct
33 Correct 2800 ms 3896 KB Output is correct
34 Correct 2800 ms 3904 KB Output is correct
35 Correct 2800 ms 2296 KB Output is correct
36 Correct 2800 ms 2212 KB Output is correct
37 Correct 2800 ms 2168 KB Output is correct
38 Correct 2800 ms 1376 KB Output is correct
39 Correct 2800 ms 1372 KB Output is correct
40 Correct 56 ms 3960 KB Output is correct
41 Correct 2800 ms 1400 KB Output is correct
42 Correct 15 ms 3960 KB Output is correct
43 Correct 89 ms 3964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2800 ms 604 KB Output is correct
2 Correct 2800 ms 632 KB Output is correct
3 Correct 2800 ms 528 KB Output is correct
4 Correct 2800 ms 512 KB Output is correct
5 Correct 2800 ms 540 KB Output is correct
6 Correct 2800 ms 628 KB Output is correct
7 Correct 2800 ms 536 KB Output is correct
8 Correct 2800 ms 516 KB Output is correct
9 Correct 2800 ms 528 KB Output is correct
10 Correct 2800 ms 520 KB Output is correct
11 Runtime error 18 ms 8236 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 8 ms 3704 KB Output is correct
4 Correct 7 ms 3832 KB Output is correct
5 Correct 7 ms 3832 KB Output is correct
6 Correct 7 ms 3832 KB Output is correct
7 Correct 7 ms 3832 KB Output is correct
8 Correct 2800 ms 580 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 565 ms 504 KB Output is correct
11 Correct 7 ms 3832 KB Output is correct
12 Correct 2800 ms 3852 KB Output is correct
13 Correct 2800 ms 508 KB Output is correct
14 Correct 2800 ms 3848 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 2800 ms 3864 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 2800 ms 3864 KB Output is correct
19 Correct 2800 ms 584 KB Output is correct
20 Correct 18 ms 3704 KB Output is correct
21 Correct 32 ms 3704 KB Output is correct
22 Correct 2800 ms 604 KB Output is correct
23 Correct 689 ms 3896 KB Output is correct
24 Correct 2800 ms 604 KB Output is correct
25 Correct 128 ms 3960 KB Output is correct
26 Correct 2800 ms 3888 KB Output is correct
27 Correct 2800 ms 3892 KB Output is correct
28 Correct 2800 ms 3884 KB Output is correct
29 Correct 2800 ms 3884 KB Output is correct
30 Correct 2800 ms 3908 KB Output is correct
31 Correct 2800 ms 3900 KB Output is correct
32 Correct 2800 ms 3916 KB Output is correct
33 Correct 2800 ms 3896 KB Output is correct
34 Correct 2800 ms 3904 KB Output is correct
35 Correct 2800 ms 2296 KB Output is correct
36 Correct 2800 ms 2212 KB Output is correct
37 Correct 2800 ms 2168 KB Output is correct
38 Correct 2800 ms 1376 KB Output is correct
39 Correct 2800 ms 1372 KB Output is correct
40 Correct 56 ms 3960 KB Output is correct
41 Correct 2800 ms 1400 KB Output is correct
42 Correct 15 ms 3960 KB Output is correct
43 Correct 89 ms 3964 KB Output is correct
44 Correct 84 ms 4108 KB Output is correct
45 Correct 2800 ms 512 KB Output is correct
46 Correct 424 ms 3960 KB Output is correct
47 Correct 2800 ms 4216 KB Output is correct
48 Correct 2800 ms 3960 KB Output is correct
49 Correct 2800 ms 4156 KB Output is correct
50 Correct 2800 ms 4148 KB Output is correct
51 Correct 2545 ms 4592 KB Output is correct
52 Correct 7 ms 3836 KB Output is correct
53 Correct 2800 ms 4732 KB Output is correct
54 Correct 849 ms 4728 KB Output is correct
55 Correct 2800 ms 3924 KB Output is correct
56 Correct 7 ms 3832 KB Output is correct
57 Correct 2800 ms 592 KB Output is correct
58 Correct 2800 ms 4728 KB Output is correct
59 Correct 497 ms 3980 KB Output is correct
60 Correct 2800 ms 3832 KB Output is correct
61 Correct 83 ms 3960 KB Output is correct
62 Correct 2800 ms 3932 KB Output is correct
63 Correct 274 ms 4088 KB Output is correct
64 Correct 2800 ms 4084 KB Output is correct
65 Correct 631 ms 3960 KB Output is correct
66 Correct 2800 ms 3932 KB Output is correct
67 Correct 147 ms 4216 KB Output is correct
68 Correct 2800 ms 4080 KB Output is correct
69 Correct 593 ms 3960 KB Output is correct
70 Correct 2801 ms 4116 KB Output is correct
71 Correct 578 ms 4344 KB Output is correct
72 Correct 2800 ms 4228 KB Output is correct
73 Correct 2800 ms 3884 KB Output is correct
74 Correct 2801 ms 4128 KB Output is correct
75 Correct 2800 ms 4224 KB Output is correct
76 Correct 2800 ms 4020 KB Output is correct
77 Correct 2806 ms 4368 KB Output is correct
78 Correct 2800 ms 3888 KB Output is correct
79 Correct 2800 ms 2440 KB Output is correct
80 Correct 2800 ms 4020 KB Output is correct
81 Correct 2800 ms 4368 KB Output is correct
82 Correct 2800 ms 1376 KB Output is correct
83 Correct 2800 ms 2448 KB Output is correct
84 Correct 2801 ms 4292 KB Output is correct
85 Correct 2800 ms 1400 KB Output is correct
86 Correct 2800 ms 4276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 8 ms 3704 KB Output is correct
4 Correct 7 ms 3832 KB Output is correct
5 Correct 7 ms 3832 KB Output is correct
6 Correct 7 ms 3832 KB Output is correct
7 Correct 7 ms 3832 KB Output is correct
8 Correct 2800 ms 580 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 565 ms 504 KB Output is correct
11 Correct 7 ms 3832 KB Output is correct
12 Correct 2800 ms 3852 KB Output is correct
13 Correct 2800 ms 508 KB Output is correct
14 Correct 2800 ms 3848 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 2800 ms 3864 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 2800 ms 3864 KB Output is correct
19 Correct 2800 ms 584 KB Output is correct
20 Correct 18 ms 3704 KB Output is correct
21 Correct 32 ms 3704 KB Output is correct
22 Correct 2800 ms 604 KB Output is correct
23 Correct 689 ms 3896 KB Output is correct
24 Correct 2800 ms 604 KB Output is correct
25 Correct 128 ms 3960 KB Output is correct
26 Correct 2800 ms 3888 KB Output is correct
27 Correct 2800 ms 3892 KB Output is correct
28 Correct 2800 ms 3884 KB Output is correct
29 Correct 2800 ms 3884 KB Output is correct
30 Correct 2800 ms 3908 KB Output is correct
31 Correct 2800 ms 3900 KB Output is correct
32 Correct 2800 ms 3916 KB Output is correct
33 Correct 2800 ms 3896 KB Output is correct
34 Correct 2800 ms 3904 KB Output is correct
35 Correct 2800 ms 2296 KB Output is correct
36 Correct 2800 ms 2212 KB Output is correct
37 Correct 2800 ms 2168 KB Output is correct
38 Correct 2800 ms 1376 KB Output is correct
39 Correct 2800 ms 1372 KB Output is correct
40 Correct 56 ms 3960 KB Output is correct
41 Correct 2800 ms 1400 KB Output is correct
42 Correct 15 ms 3960 KB Output is correct
43 Correct 89 ms 3964 KB Output is correct
44 Correct 2800 ms 508 KB Output is correct
45 Runtime error 15 ms 7416 KB Execution killed with signal 11 (could be triggered by violating memory limits)
46 Halted 0 ms 0 KB -