#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=5e4+5;
const int mod=1e9+7;
using namespace std;
int n,k,x,i,j,d[nmax],nr,rs,ts;
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);
ts=215000000/(n+n*k);
while(ts--)
{
random_shuffle(rnd.begin(),rnd.end());
vc.clear();
for(i=0;i<n;i++)
{
x=rnd[i];
nr=0;
for(j=0;j<(int)vc.size();j++)nr+=b[x][vc[j]];
if(nr==(int)vc.size())vc.pb(x);
}
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 |
3 ms |
1500 KB |
Output is correct |
2 |
Correct |
4 ms |
1528 KB |
Output is correct |
3 |
Correct |
22 ms |
22340 KB |
Output is correct |
4 |
Correct |
20 ms |
21660 KB |
Output is correct |
5 |
Correct |
22 ms |
21752 KB |
Output is correct |
6 |
Correct |
23 ms |
21624 KB |
Output is correct |
7 |
Correct |
23 ms |
21624 KB |
Output is correct |
8 |
Correct |
2923 ms |
1704 KB |
Output is correct |
9 |
Correct |
3 ms |
1500 KB |
Output is correct |
10 |
Correct |
671 ms |
1724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1500 KB |
Output is correct |
2 |
Correct |
4 ms |
1528 KB |
Output is correct |
3 |
Correct |
22 ms |
22340 KB |
Output is correct |
4 |
Correct |
20 ms |
21660 KB |
Output is correct |
5 |
Correct |
22 ms |
21752 KB |
Output is correct |
6 |
Correct |
23 ms |
21624 KB |
Output is correct |
7 |
Correct |
23 ms |
21624 KB |
Output is correct |
8 |
Correct |
2923 ms |
1704 KB |
Output is correct |
9 |
Correct |
3 ms |
1500 KB |
Output is correct |
10 |
Correct |
671 ms |
1724 KB |
Output is correct |
11 |
Correct |
23 ms |
21720 KB |
Output is correct |
12 |
Correct |
2703 ms |
21760 KB |
Output is correct |
13 |
Correct |
1999 ms |
1584 KB |
Output is correct |
14 |
Correct |
2711 ms |
21760 KB |
Output is correct |
15 |
Correct |
3 ms |
1528 KB |
Output is correct |
16 |
Correct |
2749 ms |
21820 KB |
Output is correct |
17 |
Correct |
3 ms |
1532 KB |
Output is correct |
18 |
Correct |
2654 ms |
21752 KB |
Output is correct |
19 |
Correct |
2250 ms |
1700 KB |
Output is correct |
20 |
Correct |
1045 ms |
21704 KB |
Output is correct |
21 |
Correct |
193 ms |
21624 KB |
Output is correct |
22 |
Correct |
2189 ms |
1708 KB |
Output is correct |
23 |
Correct |
24 ms |
22776 KB |
Output is correct |
24 |
Correct |
2194 ms |
1712 KB |
Output is correct |
25 |
Correct |
299 ms |
22804 KB |
Output is correct |
26 |
Correct |
2689 ms |
22084 KB |
Output is correct |
27 |
Correct |
2717 ms |
22756 KB |
Output is correct |
28 |
Correct |
2662 ms |
21908 KB |
Output is correct |
29 |
Correct |
2892 ms |
22704 KB |
Output is correct |
30 |
Correct |
2726 ms |
22648 KB |
Output is correct |
31 |
Correct |
2747 ms |
23012 KB |
Output is correct |
32 |
Correct |
2713 ms |
22748 KB |
Output is correct |
33 |
Correct |
2598 ms |
23036 KB |
Output is correct |
34 |
Correct |
2729 ms |
22944 KB |
Output is correct |
35 |
Correct |
2481 ms |
12024 KB |
Output is correct |
36 |
Correct |
2394 ms |
11972 KB |
Output is correct |
37 |
Correct |
2452 ms |
11896 KB |
Output is correct |
38 |
Correct |
2221 ms |
6648 KB |
Output is correct |
39 |
Correct |
2264 ms |
6648 KB |
Output is correct |
40 |
Correct |
68 ms |
23288 KB |
Output is correct |
41 |
Correct |
2195 ms |
6624 KB |
Output is correct |
42 |
Correct |
43 ms |
23288 KB |
Output is correct |
43 |
Correct |
80 ms |
23300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1697 ms |
1696 KB |
Output is correct |
2 |
Correct |
1268 ms |
1660 KB |
Output is correct |
3 |
Correct |
1220 ms |
1528 KB |
Output is correct |
4 |
Correct |
1410 ms |
1528 KB |
Output is correct |
5 |
Correct |
1270 ms |
1656 KB |
Output is correct |
6 |
Correct |
1256 ms |
1528 KB |
Output is correct |
7 |
Correct |
1252 ms |
1640 KB |
Output is correct |
8 |
Correct |
1235 ms |
1656 KB |
Output is correct |
9 |
Correct |
1324 ms |
1524 KB |
Output is correct |
10 |
Correct |
1337 ms |
1656 KB |
Output is correct |
11 |
Correct |
2169 ms |
308088 KB |
Output is correct |
12 |
Correct |
1249 ms |
1784 KB |
Output is correct |
13 |
Incorrect |
2215 ms |
308756 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1500 KB |
Output is correct |
2 |
Correct |
4 ms |
1528 KB |
Output is correct |
3 |
Correct |
22 ms |
22340 KB |
Output is correct |
4 |
Correct |
20 ms |
21660 KB |
Output is correct |
5 |
Correct |
22 ms |
21752 KB |
Output is correct |
6 |
Correct |
23 ms |
21624 KB |
Output is correct |
7 |
Correct |
23 ms |
21624 KB |
Output is correct |
8 |
Correct |
2923 ms |
1704 KB |
Output is correct |
9 |
Correct |
3 ms |
1500 KB |
Output is correct |
10 |
Correct |
671 ms |
1724 KB |
Output is correct |
11 |
Correct |
23 ms |
21720 KB |
Output is correct |
12 |
Correct |
2703 ms |
21760 KB |
Output is correct |
13 |
Correct |
1999 ms |
1584 KB |
Output is correct |
14 |
Correct |
2711 ms |
21760 KB |
Output is correct |
15 |
Correct |
3 ms |
1528 KB |
Output is correct |
16 |
Correct |
2749 ms |
21820 KB |
Output is correct |
17 |
Correct |
3 ms |
1532 KB |
Output is correct |
18 |
Correct |
2654 ms |
21752 KB |
Output is correct |
19 |
Correct |
2250 ms |
1700 KB |
Output is correct |
20 |
Correct |
1045 ms |
21704 KB |
Output is correct |
21 |
Correct |
193 ms |
21624 KB |
Output is correct |
22 |
Correct |
2189 ms |
1708 KB |
Output is correct |
23 |
Correct |
24 ms |
22776 KB |
Output is correct |
24 |
Correct |
2194 ms |
1712 KB |
Output is correct |
25 |
Correct |
299 ms |
22804 KB |
Output is correct |
26 |
Correct |
2689 ms |
22084 KB |
Output is correct |
27 |
Correct |
2717 ms |
22756 KB |
Output is correct |
28 |
Correct |
2662 ms |
21908 KB |
Output is correct |
29 |
Correct |
2892 ms |
22704 KB |
Output is correct |
30 |
Correct |
2726 ms |
22648 KB |
Output is correct |
31 |
Correct |
2747 ms |
23012 KB |
Output is correct |
32 |
Correct |
2713 ms |
22748 KB |
Output is correct |
33 |
Correct |
2598 ms |
23036 KB |
Output is correct |
34 |
Correct |
2729 ms |
22944 KB |
Output is correct |
35 |
Correct |
2481 ms |
12024 KB |
Output is correct |
36 |
Correct |
2394 ms |
11972 KB |
Output is correct |
37 |
Correct |
2452 ms |
11896 KB |
Output is correct |
38 |
Correct |
2221 ms |
6648 KB |
Output is correct |
39 |
Correct |
2264 ms |
6648 KB |
Output is correct |
40 |
Correct |
68 ms |
23288 KB |
Output is correct |
41 |
Correct |
2195 ms |
6624 KB |
Output is correct |
42 |
Correct |
43 ms |
23288 KB |
Output is correct |
43 |
Correct |
80 ms |
23300 KB |
Output is correct |
44 |
Correct |
75 ms |
24056 KB |
Output is correct |
45 |
Correct |
1412 ms |
1608 KB |
Output is correct |
46 |
Correct |
1804 ms |
23288 KB |
Output is correct |
47 |
Incorrect |
1636 ms |
23880 KB |
Output isn't correct |
48 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1500 KB |
Output is correct |
2 |
Correct |
4 ms |
1528 KB |
Output is correct |
3 |
Correct |
22 ms |
22340 KB |
Output is correct |
4 |
Correct |
20 ms |
21660 KB |
Output is correct |
5 |
Correct |
22 ms |
21752 KB |
Output is correct |
6 |
Correct |
23 ms |
21624 KB |
Output is correct |
7 |
Correct |
23 ms |
21624 KB |
Output is correct |
8 |
Correct |
2923 ms |
1704 KB |
Output is correct |
9 |
Correct |
3 ms |
1500 KB |
Output is correct |
10 |
Correct |
671 ms |
1724 KB |
Output is correct |
11 |
Correct |
23 ms |
21720 KB |
Output is correct |
12 |
Correct |
2703 ms |
21760 KB |
Output is correct |
13 |
Correct |
1999 ms |
1584 KB |
Output is correct |
14 |
Correct |
2711 ms |
21760 KB |
Output is correct |
15 |
Correct |
3 ms |
1528 KB |
Output is correct |
16 |
Correct |
2749 ms |
21820 KB |
Output is correct |
17 |
Correct |
3 ms |
1532 KB |
Output is correct |
18 |
Correct |
2654 ms |
21752 KB |
Output is correct |
19 |
Correct |
2250 ms |
1700 KB |
Output is correct |
20 |
Correct |
1045 ms |
21704 KB |
Output is correct |
21 |
Correct |
193 ms |
21624 KB |
Output is correct |
22 |
Correct |
2189 ms |
1708 KB |
Output is correct |
23 |
Correct |
24 ms |
22776 KB |
Output is correct |
24 |
Correct |
2194 ms |
1712 KB |
Output is correct |
25 |
Correct |
299 ms |
22804 KB |
Output is correct |
26 |
Correct |
2689 ms |
22084 KB |
Output is correct |
27 |
Correct |
2717 ms |
22756 KB |
Output is correct |
28 |
Correct |
2662 ms |
21908 KB |
Output is correct |
29 |
Correct |
2892 ms |
22704 KB |
Output is correct |
30 |
Correct |
2726 ms |
22648 KB |
Output is correct |
31 |
Correct |
2747 ms |
23012 KB |
Output is correct |
32 |
Correct |
2713 ms |
22748 KB |
Output is correct |
33 |
Correct |
2598 ms |
23036 KB |
Output is correct |
34 |
Correct |
2729 ms |
22944 KB |
Output is correct |
35 |
Correct |
2481 ms |
12024 KB |
Output is correct |
36 |
Correct |
2394 ms |
11972 KB |
Output is correct |
37 |
Correct |
2452 ms |
11896 KB |
Output is correct |
38 |
Correct |
2221 ms |
6648 KB |
Output is correct |
39 |
Correct |
2264 ms |
6648 KB |
Output is correct |
40 |
Correct |
68 ms |
23288 KB |
Output is correct |
41 |
Correct |
2195 ms |
6624 KB |
Output is correct |
42 |
Correct |
43 ms |
23288 KB |
Output is correct |
43 |
Correct |
80 ms |
23300 KB |
Output is correct |
44 |
Correct |
1404 ms |
1612 KB |
Output is correct |
45 |
Execution timed out |
3064 ms |
302584 KB |
Time limit exceeded |
46 |
Halted |
0 ms |
0 KB |
- |