#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=150000000/(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 |
1528 KB |
Output is correct |
2 |
Correct |
3 ms |
1528 KB |
Output is correct |
3 |
Correct |
23 ms |
22396 KB |
Output is correct |
4 |
Correct |
22 ms |
21752 KB |
Output is correct |
5 |
Correct |
22 ms |
21624 KB |
Output is correct |
6 |
Correct |
22 ms |
21752 KB |
Output is correct |
7 |
Correct |
22 ms |
21608 KB |
Output is correct |
8 |
Correct |
1950 ms |
1696 KB |
Output is correct |
9 |
Correct |
3 ms |
1528 KB |
Output is correct |
10 |
Correct |
44 ms |
1788 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1528 KB |
Output is correct |
2 |
Correct |
3 ms |
1528 KB |
Output is correct |
3 |
Correct |
23 ms |
22396 KB |
Output is correct |
4 |
Correct |
22 ms |
21752 KB |
Output is correct |
5 |
Correct |
22 ms |
21624 KB |
Output is correct |
6 |
Correct |
22 ms |
21752 KB |
Output is correct |
7 |
Correct |
22 ms |
21608 KB |
Output is correct |
8 |
Correct |
1950 ms |
1696 KB |
Output is correct |
9 |
Correct |
3 ms |
1528 KB |
Output is correct |
10 |
Correct |
44 ms |
1788 KB |
Output is correct |
11 |
Correct |
22 ms |
21624 KB |
Output is correct |
12 |
Correct |
1865 ms |
21704 KB |
Output is correct |
13 |
Correct |
1423 ms |
1528 KB |
Output is correct |
14 |
Correct |
1865 ms |
21752 KB |
Output is correct |
15 |
Correct |
3 ms |
1528 KB |
Output is correct |
16 |
Correct |
1912 ms |
21788 KB |
Output is correct |
17 |
Correct |
4 ms |
1500 KB |
Output is correct |
18 |
Correct |
1895 ms |
21756 KB |
Output is correct |
19 |
Correct |
1461 ms |
1700 KB |
Output is correct |
20 |
Correct |
536 ms |
21752 KB |
Output is correct |
21 |
Correct |
982 ms |
21752 KB |
Output is correct |
22 |
Correct |
1475 ms |
1716 KB |
Output is correct |
23 |
Correct |
366 ms |
22776 KB |
Output is correct |
24 |
Correct |
1472 ms |
1756 KB |
Output is correct |
25 |
Correct |
105 ms |
22780 KB |
Output is correct |
26 |
Correct |
1847 ms |
22008 KB |
Output is correct |
27 |
Correct |
1851 ms |
22800 KB |
Output is correct |
28 |
Correct |
1883 ms |
21952 KB |
Output is correct |
29 |
Correct |
1888 ms |
22744 KB |
Output is correct |
30 |
Correct |
1894 ms |
22612 KB |
Output is correct |
31 |
Correct |
1863 ms |
23032 KB |
Output is correct |
32 |
Correct |
1848 ms |
22656 KB |
Output is correct |
33 |
Correct |
1871 ms |
23020 KB |
Output is correct |
34 |
Correct |
1984 ms |
22944 KB |
Output is correct |
35 |
Correct |
1727 ms |
11980 KB |
Output is correct |
36 |
Correct |
1742 ms |
11976 KB |
Output is correct |
37 |
Correct |
1725 ms |
11952 KB |
Output is correct |
38 |
Correct |
1541 ms |
6660 KB |
Output is correct |
39 |
Correct |
1583 ms |
6636 KB |
Output is correct |
40 |
Correct |
53 ms |
23260 KB |
Output is correct |
41 |
Correct |
1534 ms |
6628 KB |
Output is correct |
42 |
Correct |
83 ms |
23344 KB |
Output is correct |
43 |
Correct |
124 ms |
23300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1211 ms |
1704 KB |
Output is correct |
2 |
Correct |
864 ms |
1640 KB |
Output is correct |
3 |
Correct |
857 ms |
1648 KB |
Output is correct |
4 |
Correct |
981 ms |
1628 KB |
Output is correct |
5 |
Correct |
870 ms |
1756 KB |
Output is correct |
6 |
Correct |
887 ms |
1656 KB |
Output is correct |
7 |
Correct |
873 ms |
1656 KB |
Output is correct |
8 |
Correct |
892 ms |
1656 KB |
Output is correct |
9 |
Correct |
872 ms |
1640 KB |
Output is correct |
10 |
Correct |
902 ms |
1640 KB |
Output is correct |
11 |
Incorrect |
1546 ms |
308104 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1528 KB |
Output is correct |
2 |
Correct |
3 ms |
1528 KB |
Output is correct |
3 |
Correct |
23 ms |
22396 KB |
Output is correct |
4 |
Correct |
22 ms |
21752 KB |
Output is correct |
5 |
Correct |
22 ms |
21624 KB |
Output is correct |
6 |
Correct |
22 ms |
21752 KB |
Output is correct |
7 |
Correct |
22 ms |
21608 KB |
Output is correct |
8 |
Correct |
1950 ms |
1696 KB |
Output is correct |
9 |
Correct |
3 ms |
1528 KB |
Output is correct |
10 |
Correct |
44 ms |
1788 KB |
Output is correct |
11 |
Correct |
22 ms |
21624 KB |
Output is correct |
12 |
Correct |
1865 ms |
21704 KB |
Output is correct |
13 |
Correct |
1423 ms |
1528 KB |
Output is correct |
14 |
Correct |
1865 ms |
21752 KB |
Output is correct |
15 |
Correct |
3 ms |
1528 KB |
Output is correct |
16 |
Correct |
1912 ms |
21788 KB |
Output is correct |
17 |
Correct |
4 ms |
1500 KB |
Output is correct |
18 |
Correct |
1895 ms |
21756 KB |
Output is correct |
19 |
Correct |
1461 ms |
1700 KB |
Output is correct |
20 |
Correct |
536 ms |
21752 KB |
Output is correct |
21 |
Correct |
982 ms |
21752 KB |
Output is correct |
22 |
Correct |
1475 ms |
1716 KB |
Output is correct |
23 |
Correct |
366 ms |
22776 KB |
Output is correct |
24 |
Correct |
1472 ms |
1756 KB |
Output is correct |
25 |
Correct |
105 ms |
22780 KB |
Output is correct |
26 |
Correct |
1847 ms |
22008 KB |
Output is correct |
27 |
Correct |
1851 ms |
22800 KB |
Output is correct |
28 |
Correct |
1883 ms |
21952 KB |
Output is correct |
29 |
Correct |
1888 ms |
22744 KB |
Output is correct |
30 |
Correct |
1894 ms |
22612 KB |
Output is correct |
31 |
Correct |
1863 ms |
23032 KB |
Output is correct |
32 |
Correct |
1848 ms |
22656 KB |
Output is correct |
33 |
Correct |
1871 ms |
23020 KB |
Output is correct |
34 |
Correct |
1984 ms |
22944 KB |
Output is correct |
35 |
Correct |
1727 ms |
11980 KB |
Output is correct |
36 |
Correct |
1742 ms |
11976 KB |
Output is correct |
37 |
Correct |
1725 ms |
11952 KB |
Output is correct |
38 |
Correct |
1541 ms |
6660 KB |
Output is correct |
39 |
Correct |
1583 ms |
6636 KB |
Output is correct |
40 |
Correct |
53 ms |
23260 KB |
Output is correct |
41 |
Correct |
1534 ms |
6628 KB |
Output is correct |
42 |
Correct |
83 ms |
23344 KB |
Output is correct |
43 |
Correct |
124 ms |
23300 KB |
Output is correct |
44 |
Correct |
270 ms |
24388 KB |
Output is correct |
45 |
Correct |
988 ms |
1612 KB |
Output is correct |
46 |
Incorrect |
1569 ms |
23376 KB |
Output isn't correct |
47 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1528 KB |
Output is correct |
2 |
Correct |
3 ms |
1528 KB |
Output is correct |
3 |
Correct |
23 ms |
22396 KB |
Output is correct |
4 |
Correct |
22 ms |
21752 KB |
Output is correct |
5 |
Correct |
22 ms |
21624 KB |
Output is correct |
6 |
Correct |
22 ms |
21752 KB |
Output is correct |
7 |
Correct |
22 ms |
21608 KB |
Output is correct |
8 |
Correct |
1950 ms |
1696 KB |
Output is correct |
9 |
Correct |
3 ms |
1528 KB |
Output is correct |
10 |
Correct |
44 ms |
1788 KB |
Output is correct |
11 |
Correct |
22 ms |
21624 KB |
Output is correct |
12 |
Correct |
1865 ms |
21704 KB |
Output is correct |
13 |
Correct |
1423 ms |
1528 KB |
Output is correct |
14 |
Correct |
1865 ms |
21752 KB |
Output is correct |
15 |
Correct |
3 ms |
1528 KB |
Output is correct |
16 |
Correct |
1912 ms |
21788 KB |
Output is correct |
17 |
Correct |
4 ms |
1500 KB |
Output is correct |
18 |
Correct |
1895 ms |
21756 KB |
Output is correct |
19 |
Correct |
1461 ms |
1700 KB |
Output is correct |
20 |
Correct |
536 ms |
21752 KB |
Output is correct |
21 |
Correct |
982 ms |
21752 KB |
Output is correct |
22 |
Correct |
1475 ms |
1716 KB |
Output is correct |
23 |
Correct |
366 ms |
22776 KB |
Output is correct |
24 |
Correct |
1472 ms |
1756 KB |
Output is correct |
25 |
Correct |
105 ms |
22780 KB |
Output is correct |
26 |
Correct |
1847 ms |
22008 KB |
Output is correct |
27 |
Correct |
1851 ms |
22800 KB |
Output is correct |
28 |
Correct |
1883 ms |
21952 KB |
Output is correct |
29 |
Correct |
1888 ms |
22744 KB |
Output is correct |
30 |
Correct |
1894 ms |
22612 KB |
Output is correct |
31 |
Correct |
1863 ms |
23032 KB |
Output is correct |
32 |
Correct |
1848 ms |
22656 KB |
Output is correct |
33 |
Correct |
1871 ms |
23020 KB |
Output is correct |
34 |
Correct |
1984 ms |
22944 KB |
Output is correct |
35 |
Correct |
1727 ms |
11980 KB |
Output is correct |
36 |
Correct |
1742 ms |
11976 KB |
Output is correct |
37 |
Correct |
1725 ms |
11952 KB |
Output is correct |
38 |
Correct |
1541 ms |
6660 KB |
Output is correct |
39 |
Correct |
1583 ms |
6636 KB |
Output is correct |
40 |
Correct |
53 ms |
23260 KB |
Output is correct |
41 |
Correct |
1534 ms |
6628 KB |
Output is correct |
42 |
Correct |
83 ms |
23344 KB |
Output is correct |
43 |
Correct |
124 ms |
23300 KB |
Output is correct |
44 |
Correct |
979 ms |
1616 KB |
Output is correct |
45 |
Execution timed out |
3050 ms |
303600 KB |
Time limit exceeded |
46 |
Halted |
0 ms |
0 KB |
- |