#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
using namespace std;
#define int long long
#define pb push_back
#define nl '\n'
#define fore(i, y) for(int i = 0; i < y; i++)
#define forr(i, x, y) for(int i = x;i<=y;i++)
#define forn(i, y, x) for(int i = y; i >= x; i--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 50000;
vector<bitset<N>> adj(N , 0);
int n , k;
bitset<N> cur = 0;
//bool done[N];
int maxClique(int i)
{
cur = adj[i];
int last = i;
int cnt = 0;
while(true)
{
cnt++;
cur&=adj[last];
vector<int> candidates;
for(int j = cur._Find_first() ; j < N ; j = cur._Find_next(j))
{
candidates.pb(j);
}
if(candidates.empty())
break;
last = candidates[uniform_int_distribution<int>(0 , (int)candidates.size() - 1)(rng)];
}
return cnt;
}
signed main() {
// ios::sync_with_stdio(0);
// cin.tie(0);
// cout.tie(0);
cin>>n>>k;
fore(i , n)
{
int d;
cin>>d;
fore(j , d)
{
int x;
cin>>x;
if(x != i)
adj[i][x] = 1;
}
}
int best = 0;
vector<int> p(n);
fore(i , n)
p[i] = i;
fore(i , 10 * n)
{
if(i % n == 0)
{
shuffle(p.begin() , p.end() , rng);
}
best = max(best , maxClique(p[i%n]));
}
cout<<best<<nl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
306332 KB |
Output is correct |
2 |
Correct |
91 ms |
306452 KB |
Output is correct |
3 |
Correct |
188 ms |
306512 KB |
Output is correct |
4 |
Correct |
188 ms |
306692 KB |
Output is correct |
5 |
Correct |
190 ms |
306512 KB |
Output is correct |
6 |
Correct |
180 ms |
306508 KB |
Output is correct |
7 |
Correct |
187 ms |
306516 KB |
Output is correct |
8 |
Correct |
132 ms |
306512 KB |
Output is correct |
9 |
Correct |
94 ms |
306256 KB |
Output is correct |
10 |
Correct |
141 ms |
306520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
306332 KB |
Output is correct |
2 |
Correct |
91 ms |
306452 KB |
Output is correct |
3 |
Correct |
188 ms |
306512 KB |
Output is correct |
4 |
Correct |
188 ms |
306692 KB |
Output is correct |
5 |
Correct |
190 ms |
306512 KB |
Output is correct |
6 |
Correct |
180 ms |
306508 KB |
Output is correct |
7 |
Correct |
187 ms |
306516 KB |
Output is correct |
8 |
Correct |
132 ms |
306512 KB |
Output is correct |
9 |
Correct |
94 ms |
306256 KB |
Output is correct |
10 |
Correct |
141 ms |
306520 KB |
Output is correct |
11 |
Correct |
189 ms |
306680 KB |
Output is correct |
12 |
Correct |
180 ms |
306512 KB |
Output is correct |
13 |
Correct |
94 ms |
306260 KB |
Output is correct |
14 |
Correct |
179 ms |
306508 KB |
Output is correct |
15 |
Correct |
94 ms |
306256 KB |
Output is correct |
16 |
Correct |
234 ms |
306448 KB |
Output is correct |
17 |
Correct |
94 ms |
306512 KB |
Output is correct |
18 |
Correct |
182 ms |
306768 KB |
Output is correct |
19 |
Correct |
145 ms |
306508 KB |
Output is correct |
20 |
Correct |
176 ms |
306508 KB |
Output is correct |
21 |
Correct |
185 ms |
306324 KB |
Output is correct |
22 |
Correct |
141 ms |
306516 KB |
Output is correct |
23 |
Correct |
189 ms |
306512 KB |
Output is correct |
24 |
Correct |
131 ms |
306472 KB |
Output is correct |
25 |
Correct |
187 ms |
306516 KB |
Output is correct |
26 |
Correct |
178 ms |
306352 KB |
Output is correct |
27 |
Correct |
190 ms |
306584 KB |
Output is correct |
28 |
Correct |
191 ms |
306512 KB |
Output is correct |
29 |
Correct |
199 ms |
306360 KB |
Output is correct |
30 |
Correct |
183 ms |
306540 KB |
Output is correct |
31 |
Correct |
191 ms |
306516 KB |
Output is correct |
32 |
Correct |
181 ms |
306512 KB |
Output is correct |
33 |
Correct |
191 ms |
306512 KB |
Output is correct |
34 |
Correct |
186 ms |
306460 KB |
Output is correct |
35 |
Correct |
166 ms |
306340 KB |
Output is correct |
36 |
Correct |
134 ms |
306516 KB |
Output is correct |
37 |
Correct |
143 ms |
306436 KB |
Output is correct |
38 |
Correct |
114 ms |
306772 KB |
Output is correct |
39 |
Correct |
110 ms |
306592 KB |
Output is correct |
40 |
Correct |
197 ms |
306512 KB |
Output is correct |
41 |
Correct |
112 ms |
306516 KB |
Output is correct |
42 |
Correct |
191 ms |
306512 KB |
Output is correct |
43 |
Correct |
188 ms |
306516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
140 ms |
306516 KB |
Output is correct |
2 |
Correct |
92 ms |
306424 KB |
Output is correct |
3 |
Correct |
94 ms |
306364 KB |
Output is correct |
4 |
Correct |
107 ms |
306260 KB |
Output is correct |
5 |
Correct |
91 ms |
306512 KB |
Output is correct |
6 |
Correct |
101 ms |
306508 KB |
Output is correct |
7 |
Correct |
91 ms |
306260 KB |
Output is correct |
8 |
Correct |
96 ms |
306256 KB |
Output is correct |
9 |
Correct |
94 ms |
306260 KB |
Output is correct |
10 |
Correct |
86 ms |
306256 KB |
Output is correct |
11 |
Correct |
1569 ms |
309420 KB |
Output is correct |
12 |
Correct |
88 ms |
306260 KB |
Output is correct |
13 |
Correct |
1536 ms |
308996 KB |
Output is correct |
14 |
Correct |
100 ms |
306640 KB |
Output is correct |
15 |
Correct |
1587 ms |
309204 KB |
Output is correct |
16 |
Correct |
1599 ms |
309000 KB |
Output is correct |
17 |
Correct |
1745 ms |
309136 KB |
Output is correct |
18 |
Correct |
1726 ms |
309076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
306332 KB |
Output is correct |
2 |
Correct |
91 ms |
306452 KB |
Output is correct |
3 |
Correct |
188 ms |
306512 KB |
Output is correct |
4 |
Correct |
188 ms |
306692 KB |
Output is correct |
5 |
Correct |
190 ms |
306512 KB |
Output is correct |
6 |
Correct |
180 ms |
306508 KB |
Output is correct |
7 |
Correct |
187 ms |
306516 KB |
Output is correct |
8 |
Correct |
132 ms |
306512 KB |
Output is correct |
9 |
Correct |
94 ms |
306256 KB |
Output is correct |
10 |
Correct |
141 ms |
306520 KB |
Output is correct |
11 |
Correct |
189 ms |
306680 KB |
Output is correct |
12 |
Correct |
180 ms |
306512 KB |
Output is correct |
13 |
Correct |
94 ms |
306260 KB |
Output is correct |
14 |
Correct |
179 ms |
306508 KB |
Output is correct |
15 |
Correct |
94 ms |
306256 KB |
Output is correct |
16 |
Correct |
234 ms |
306448 KB |
Output is correct |
17 |
Correct |
94 ms |
306512 KB |
Output is correct |
18 |
Correct |
182 ms |
306768 KB |
Output is correct |
19 |
Correct |
145 ms |
306508 KB |
Output is correct |
20 |
Correct |
176 ms |
306508 KB |
Output is correct |
21 |
Correct |
185 ms |
306324 KB |
Output is correct |
22 |
Correct |
141 ms |
306516 KB |
Output is correct |
23 |
Correct |
189 ms |
306512 KB |
Output is correct |
24 |
Correct |
131 ms |
306472 KB |
Output is correct |
25 |
Correct |
187 ms |
306516 KB |
Output is correct |
26 |
Correct |
178 ms |
306352 KB |
Output is correct |
27 |
Correct |
190 ms |
306584 KB |
Output is correct |
28 |
Correct |
191 ms |
306512 KB |
Output is correct |
29 |
Correct |
199 ms |
306360 KB |
Output is correct |
30 |
Correct |
183 ms |
306540 KB |
Output is correct |
31 |
Correct |
191 ms |
306516 KB |
Output is correct |
32 |
Correct |
181 ms |
306512 KB |
Output is correct |
33 |
Correct |
191 ms |
306512 KB |
Output is correct |
34 |
Correct |
186 ms |
306460 KB |
Output is correct |
35 |
Correct |
166 ms |
306340 KB |
Output is correct |
36 |
Correct |
134 ms |
306516 KB |
Output is correct |
37 |
Correct |
143 ms |
306436 KB |
Output is correct |
38 |
Correct |
114 ms |
306772 KB |
Output is correct |
39 |
Correct |
110 ms |
306592 KB |
Output is correct |
40 |
Correct |
197 ms |
306512 KB |
Output is correct |
41 |
Correct |
112 ms |
306516 KB |
Output is correct |
42 |
Correct |
191 ms |
306512 KB |
Output is correct |
43 |
Correct |
188 ms |
306516 KB |
Output is correct |
44 |
Correct |
681 ms |
306744 KB |
Output is correct |
45 |
Correct |
117 ms |
306476 KB |
Output is correct |
46 |
Correct |
249 ms |
306512 KB |
Output is correct |
47 |
Correct |
249 ms |
306516 KB |
Output is correct |
48 |
Correct |
222 ms |
306516 KB |
Output is correct |
49 |
Correct |
229 ms |
306592 KB |
Output is correct |
50 |
Correct |
215 ms |
306516 KB |
Output is correct |
51 |
Correct |
244 ms |
306772 KB |
Output is correct |
52 |
Correct |
187 ms |
306512 KB |
Output is correct |
53 |
Correct |
249 ms |
307052 KB |
Output is correct |
54 |
Correct |
235 ms |
306828 KB |
Output is correct |
55 |
Correct |
240 ms |
306516 KB |
Output is correct |
56 |
Correct |
214 ms |
306512 KB |
Output is correct |
57 |
Correct |
168 ms |
306520 KB |
Output is correct |
58 |
Correct |
233 ms |
307028 KB |
Output is correct |
59 |
Correct |
382 ms |
306628 KB |
Output is correct |
60 |
Correct |
211 ms |
306512 KB |
Output is correct |
61 |
Correct |
387 ms |
306768 KB |
Output is correct |
62 |
Correct |
378 ms |
306516 KB |
Output is correct |
63 |
Correct |
663 ms |
306516 KB |
Output is correct |
64 |
Correct |
548 ms |
306516 KB |
Output is correct |
65 |
Correct |
225 ms |
306516 KB |
Output is correct |
66 |
Correct |
392 ms |
306516 KB |
Output is correct |
67 |
Correct |
302 ms |
306772 KB |
Output is correct |
68 |
Correct |
602 ms |
306516 KB |
Output is correct |
69 |
Correct |
218 ms |
306536 KB |
Output is correct |
70 |
Correct |
309 ms |
306616 KB |
Output is correct |
71 |
Correct |
270 ms |
306568 KB |
Output is correct |
72 |
Correct |
267 ms |
306772 KB |
Output is correct |
73 |
Correct |
249 ms |
306768 KB |
Output is correct |
74 |
Correct |
308 ms |
306516 KB |
Output is correct |
75 |
Correct |
294 ms |
306772 KB |
Output is correct |
76 |
Correct |
229 ms |
306472 KB |
Output is correct |
77 |
Correct |
256 ms |
306768 KB |
Output is correct |
78 |
Correct |
248 ms |
306512 KB |
Output is correct |
79 |
Correct |
184 ms |
306524 KB |
Output is correct |
80 |
Correct |
223 ms |
306512 KB |
Output is correct |
81 |
Correct |
229 ms |
306772 KB |
Output is correct |
82 |
Correct |
133 ms |
306512 KB |
Output is correct |
83 |
Correct |
168 ms |
306504 KB |
Output is correct |
84 |
Correct |
234 ms |
306760 KB |
Output is correct |
85 |
Correct |
152 ms |
306516 KB |
Output is correct |
86 |
Correct |
248 ms |
306516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
306332 KB |
Output is correct |
2 |
Correct |
91 ms |
306452 KB |
Output is correct |
3 |
Correct |
188 ms |
306512 KB |
Output is correct |
4 |
Correct |
188 ms |
306692 KB |
Output is correct |
5 |
Correct |
190 ms |
306512 KB |
Output is correct |
6 |
Correct |
180 ms |
306508 KB |
Output is correct |
7 |
Correct |
187 ms |
306516 KB |
Output is correct |
8 |
Correct |
132 ms |
306512 KB |
Output is correct |
9 |
Correct |
94 ms |
306256 KB |
Output is correct |
10 |
Correct |
141 ms |
306520 KB |
Output is correct |
11 |
Correct |
189 ms |
306680 KB |
Output is correct |
12 |
Correct |
180 ms |
306512 KB |
Output is correct |
13 |
Correct |
94 ms |
306260 KB |
Output is correct |
14 |
Correct |
179 ms |
306508 KB |
Output is correct |
15 |
Correct |
94 ms |
306256 KB |
Output is correct |
16 |
Correct |
234 ms |
306448 KB |
Output is correct |
17 |
Correct |
94 ms |
306512 KB |
Output is correct |
18 |
Correct |
182 ms |
306768 KB |
Output is correct |
19 |
Correct |
145 ms |
306508 KB |
Output is correct |
20 |
Correct |
176 ms |
306508 KB |
Output is correct |
21 |
Correct |
185 ms |
306324 KB |
Output is correct |
22 |
Correct |
141 ms |
306516 KB |
Output is correct |
23 |
Correct |
189 ms |
306512 KB |
Output is correct |
24 |
Correct |
131 ms |
306472 KB |
Output is correct |
25 |
Correct |
187 ms |
306516 KB |
Output is correct |
26 |
Correct |
178 ms |
306352 KB |
Output is correct |
27 |
Correct |
190 ms |
306584 KB |
Output is correct |
28 |
Correct |
191 ms |
306512 KB |
Output is correct |
29 |
Correct |
199 ms |
306360 KB |
Output is correct |
30 |
Correct |
183 ms |
306540 KB |
Output is correct |
31 |
Correct |
191 ms |
306516 KB |
Output is correct |
32 |
Correct |
181 ms |
306512 KB |
Output is correct |
33 |
Correct |
191 ms |
306512 KB |
Output is correct |
34 |
Correct |
186 ms |
306460 KB |
Output is correct |
35 |
Correct |
166 ms |
306340 KB |
Output is correct |
36 |
Correct |
134 ms |
306516 KB |
Output is correct |
37 |
Correct |
143 ms |
306436 KB |
Output is correct |
38 |
Correct |
114 ms |
306772 KB |
Output is correct |
39 |
Correct |
110 ms |
306592 KB |
Output is correct |
40 |
Correct |
197 ms |
306512 KB |
Output is correct |
41 |
Correct |
112 ms |
306516 KB |
Output is correct |
42 |
Correct |
191 ms |
306512 KB |
Output is correct |
43 |
Correct |
188 ms |
306516 KB |
Output is correct |
44 |
Correct |
104 ms |
306256 KB |
Output is correct |
45 |
Correct |
1595 ms |
308688 KB |
Output is correct |
46 |
Correct |
1695 ms |
308288 KB |
Output is correct |
47 |
Correct |
1611 ms |
308704 KB |
Output is correct |
48 |
Correct |
1569 ms |
308704 KB |
Output is correct |
49 |
Correct |
1136 ms |
308292 KB |
Output is correct |
50 |
Correct |
1337 ms |
310160 KB |
Output is correct |
51 |
Correct |
1597 ms |
308696 KB |
Output is correct |
52 |
Correct |
1208 ms |
307540 KB |
Output is correct |
53 |
Correct |
1151 ms |
308472 KB |
Output is correct |
54 |
Correct |
755 ms |
306840 KB |
Output is correct |
55 |
Correct |
1352 ms |
310168 KB |
Output is correct |
56 |
Correct |
1412 ms |
307280 KB |
Output is correct |
57 |
Correct |
1192 ms |
307508 KB |
Output is correct |
58 |
Correct |
2768 ms |
307852 KB |
Output is correct |
59 |
Correct |
1385 ms |
307060 KB |
Output is correct |
60 |
Correct |
1365 ms |
307280 KB |
Output is correct |
61 |
Correct |
2840 ms |
307776 KB |
Output is correct |
62 |
Correct |
2004 ms |
307520 KB |
Output is correct |
63 |
Correct |
1552 ms |
307984 KB |
Output is correct |
64 |
Correct |
1352 ms |
307280 KB |
Output is correct |
65 |
Correct |
1646 ms |
308048 KB |
Output is correct |
66 |
Correct |
2045 ms |
307396 KB |
Output is correct |
67 |
Correct |
1532 ms |
307796 KB |
Output is correct |
68 |
Correct |
1593 ms |
308052 KB |
Output is correct |
69 |
Correct |
1671 ms |
308108 KB |
Output is correct |
70 |
Correct |
1485 ms |
307552 KB |
Output is correct |
71 |
Correct |
1643 ms |
308172 KB |
Output is correct |
72 |
Correct |
1383 ms |
308568 KB |
Output is correct |
73 |
Correct |
1606 ms |
308308 KB |
Output is correct |
74 |
Correct |
1463 ms |
307540 KB |
Output is correct |
75 |
Correct |
783 ms |
307284 KB |
Output is correct |
76 |
Correct |
1414 ms |
308416 KB |
Output is correct |
77 |
Correct |
1561 ms |
308452 KB |
Output is correct |
78 |
Correct |
827 ms |
307452 KB |
Output is correct |
79 |
Correct |
833 ms |
307032 KB |
Output is correct |
80 |
Correct |
402 ms |
306772 KB |
Output is correct |
81 |
Correct |
791 ms |
307448 KB |
Output is correct |
82 |
Correct |
1477 ms |
307944 KB |
Output is correct |
83 |
Correct |
359 ms |
306868 KB |
Output is correct |
84 |
Correct |
1601 ms |
308132 KB |
Output is correct |