#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() ; (int)candidates.size() < 10 && 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 , 5 * n)
{
best = max(best , maxClique(i%n));
}
cout<<best<<nl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
74 ms |
306512 KB |
Output is correct |
2 |
Correct |
72 ms |
306448 KB |
Output is correct |
3 |
Correct |
101 ms |
306516 KB |
Output is correct |
4 |
Correct |
102 ms |
306520 KB |
Output is correct |
5 |
Correct |
94 ms |
306400 KB |
Output is correct |
6 |
Correct |
99 ms |
306596 KB |
Output is correct |
7 |
Correct |
97 ms |
306520 KB |
Output is correct |
8 |
Correct |
83 ms |
306384 KB |
Output is correct |
9 |
Correct |
71 ms |
306296 KB |
Output is correct |
10 |
Correct |
94 ms |
306484 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
74 ms |
306512 KB |
Output is correct |
2 |
Correct |
72 ms |
306448 KB |
Output is correct |
3 |
Correct |
101 ms |
306516 KB |
Output is correct |
4 |
Correct |
102 ms |
306520 KB |
Output is correct |
5 |
Correct |
94 ms |
306400 KB |
Output is correct |
6 |
Correct |
99 ms |
306596 KB |
Output is correct |
7 |
Correct |
97 ms |
306520 KB |
Output is correct |
8 |
Correct |
83 ms |
306384 KB |
Output is correct |
9 |
Correct |
71 ms |
306296 KB |
Output is correct |
10 |
Correct |
94 ms |
306484 KB |
Output is correct |
11 |
Correct |
129 ms |
306516 KB |
Output is correct |
12 |
Correct |
96 ms |
306512 KB |
Output is correct |
13 |
Correct |
87 ms |
306396 KB |
Output is correct |
14 |
Correct |
93 ms |
306604 KB |
Output is correct |
15 |
Correct |
81 ms |
306512 KB |
Output is correct |
16 |
Correct |
96 ms |
306516 KB |
Output is correct |
17 |
Correct |
92 ms |
306512 KB |
Output is correct |
18 |
Correct |
95 ms |
306580 KB |
Output is correct |
19 |
Correct |
89 ms |
306516 KB |
Output is correct |
20 |
Correct |
94 ms |
306512 KB |
Output is correct |
21 |
Correct |
97 ms |
306528 KB |
Output is correct |
22 |
Correct |
84 ms |
306512 KB |
Output is correct |
23 |
Correct |
101 ms |
306508 KB |
Output is correct |
24 |
Correct |
91 ms |
306516 KB |
Output is correct |
25 |
Correct |
98 ms |
306516 KB |
Output is correct |
26 |
Correct |
104 ms |
306588 KB |
Output is correct |
27 |
Correct |
100 ms |
306512 KB |
Output is correct |
28 |
Correct |
101 ms |
306484 KB |
Output is correct |
29 |
Correct |
100 ms |
306516 KB |
Output is correct |
30 |
Correct |
96 ms |
306496 KB |
Output is correct |
31 |
Correct |
109 ms |
306516 KB |
Output is correct |
32 |
Correct |
105 ms |
306516 KB |
Output is correct |
33 |
Correct |
104 ms |
306576 KB |
Output is correct |
34 |
Correct |
102 ms |
306468 KB |
Output is correct |
35 |
Correct |
85 ms |
306512 KB |
Output is correct |
36 |
Correct |
93 ms |
306616 KB |
Output is correct |
37 |
Correct |
84 ms |
306520 KB |
Output is correct |
38 |
Correct |
98 ms |
306516 KB |
Output is correct |
39 |
Correct |
77 ms |
306516 KB |
Output is correct |
40 |
Correct |
102 ms |
306524 KB |
Output is correct |
41 |
Correct |
77 ms |
306460 KB |
Output is correct |
42 |
Correct |
100 ms |
306512 KB |
Output is correct |
43 |
Correct |
100 ms |
306516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
91 ms |
306392 KB |
Output is correct |
2 |
Correct |
77 ms |
306464 KB |
Output is correct |
3 |
Correct |
72 ms |
306388 KB |
Output is correct |
4 |
Correct |
74 ms |
306296 KB |
Output is correct |
5 |
Correct |
71 ms |
306312 KB |
Output is correct |
6 |
Correct |
77 ms |
306468 KB |
Output is correct |
7 |
Correct |
73 ms |
306512 KB |
Output is correct |
8 |
Correct |
72 ms |
306360 KB |
Output is correct |
9 |
Correct |
74 ms |
306516 KB |
Output is correct |
10 |
Correct |
71 ms |
306332 KB |
Output is correct |
11 |
Correct |
573 ms |
309072 KB |
Output is correct |
12 |
Correct |
77 ms |
306516 KB |
Output is correct |
13 |
Correct |
546 ms |
309200 KB |
Output is correct |
14 |
Correct |
71 ms |
306516 KB |
Output is correct |
15 |
Correct |
562 ms |
309072 KB |
Output is correct |
16 |
Correct |
559 ms |
309072 KB |
Output is correct |
17 |
Correct |
556 ms |
309016 KB |
Output is correct |
18 |
Correct |
591 ms |
309076 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
74 ms |
306512 KB |
Output is correct |
2 |
Correct |
72 ms |
306448 KB |
Output is correct |
3 |
Correct |
101 ms |
306516 KB |
Output is correct |
4 |
Correct |
102 ms |
306520 KB |
Output is correct |
5 |
Correct |
94 ms |
306400 KB |
Output is correct |
6 |
Correct |
99 ms |
306596 KB |
Output is correct |
7 |
Correct |
97 ms |
306520 KB |
Output is correct |
8 |
Correct |
83 ms |
306384 KB |
Output is correct |
9 |
Correct |
71 ms |
306296 KB |
Output is correct |
10 |
Correct |
94 ms |
306484 KB |
Output is correct |
11 |
Correct |
129 ms |
306516 KB |
Output is correct |
12 |
Correct |
96 ms |
306512 KB |
Output is correct |
13 |
Correct |
87 ms |
306396 KB |
Output is correct |
14 |
Correct |
93 ms |
306604 KB |
Output is correct |
15 |
Correct |
81 ms |
306512 KB |
Output is correct |
16 |
Correct |
96 ms |
306516 KB |
Output is correct |
17 |
Correct |
92 ms |
306512 KB |
Output is correct |
18 |
Correct |
95 ms |
306580 KB |
Output is correct |
19 |
Correct |
89 ms |
306516 KB |
Output is correct |
20 |
Correct |
94 ms |
306512 KB |
Output is correct |
21 |
Correct |
97 ms |
306528 KB |
Output is correct |
22 |
Correct |
84 ms |
306512 KB |
Output is correct |
23 |
Correct |
101 ms |
306508 KB |
Output is correct |
24 |
Correct |
91 ms |
306516 KB |
Output is correct |
25 |
Correct |
98 ms |
306516 KB |
Output is correct |
26 |
Correct |
104 ms |
306588 KB |
Output is correct |
27 |
Correct |
100 ms |
306512 KB |
Output is correct |
28 |
Correct |
101 ms |
306484 KB |
Output is correct |
29 |
Correct |
100 ms |
306516 KB |
Output is correct |
30 |
Correct |
96 ms |
306496 KB |
Output is correct |
31 |
Correct |
109 ms |
306516 KB |
Output is correct |
32 |
Correct |
105 ms |
306516 KB |
Output is correct |
33 |
Correct |
104 ms |
306576 KB |
Output is correct |
34 |
Correct |
102 ms |
306468 KB |
Output is correct |
35 |
Correct |
85 ms |
306512 KB |
Output is correct |
36 |
Correct |
93 ms |
306616 KB |
Output is correct |
37 |
Correct |
84 ms |
306520 KB |
Output is correct |
38 |
Correct |
98 ms |
306516 KB |
Output is correct |
39 |
Correct |
77 ms |
306516 KB |
Output is correct |
40 |
Correct |
102 ms |
306524 KB |
Output is correct |
41 |
Correct |
77 ms |
306460 KB |
Output is correct |
42 |
Correct |
100 ms |
306512 KB |
Output is correct |
43 |
Correct |
100 ms |
306516 KB |
Output is correct |
44 |
Correct |
194 ms |
306756 KB |
Output is correct |
45 |
Correct |
74 ms |
306392 KB |
Output is correct |
46 |
Correct |
116 ms |
306408 KB |
Output is correct |
47 |
Correct |
114 ms |
306516 KB |
Output is correct |
48 |
Correct |
117 ms |
306516 KB |
Output is correct |
49 |
Incorrect |
114 ms |
306516 KB |
Output isn't correct |
50 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
74 ms |
306512 KB |
Output is correct |
2 |
Correct |
72 ms |
306448 KB |
Output is correct |
3 |
Correct |
101 ms |
306516 KB |
Output is correct |
4 |
Correct |
102 ms |
306520 KB |
Output is correct |
5 |
Correct |
94 ms |
306400 KB |
Output is correct |
6 |
Correct |
99 ms |
306596 KB |
Output is correct |
7 |
Correct |
97 ms |
306520 KB |
Output is correct |
8 |
Correct |
83 ms |
306384 KB |
Output is correct |
9 |
Correct |
71 ms |
306296 KB |
Output is correct |
10 |
Correct |
94 ms |
306484 KB |
Output is correct |
11 |
Correct |
129 ms |
306516 KB |
Output is correct |
12 |
Correct |
96 ms |
306512 KB |
Output is correct |
13 |
Correct |
87 ms |
306396 KB |
Output is correct |
14 |
Correct |
93 ms |
306604 KB |
Output is correct |
15 |
Correct |
81 ms |
306512 KB |
Output is correct |
16 |
Correct |
96 ms |
306516 KB |
Output is correct |
17 |
Correct |
92 ms |
306512 KB |
Output is correct |
18 |
Correct |
95 ms |
306580 KB |
Output is correct |
19 |
Correct |
89 ms |
306516 KB |
Output is correct |
20 |
Correct |
94 ms |
306512 KB |
Output is correct |
21 |
Correct |
97 ms |
306528 KB |
Output is correct |
22 |
Correct |
84 ms |
306512 KB |
Output is correct |
23 |
Correct |
101 ms |
306508 KB |
Output is correct |
24 |
Correct |
91 ms |
306516 KB |
Output is correct |
25 |
Correct |
98 ms |
306516 KB |
Output is correct |
26 |
Correct |
104 ms |
306588 KB |
Output is correct |
27 |
Correct |
100 ms |
306512 KB |
Output is correct |
28 |
Correct |
101 ms |
306484 KB |
Output is correct |
29 |
Correct |
100 ms |
306516 KB |
Output is correct |
30 |
Correct |
96 ms |
306496 KB |
Output is correct |
31 |
Correct |
109 ms |
306516 KB |
Output is correct |
32 |
Correct |
105 ms |
306516 KB |
Output is correct |
33 |
Correct |
104 ms |
306576 KB |
Output is correct |
34 |
Correct |
102 ms |
306468 KB |
Output is correct |
35 |
Correct |
85 ms |
306512 KB |
Output is correct |
36 |
Correct |
93 ms |
306616 KB |
Output is correct |
37 |
Correct |
84 ms |
306520 KB |
Output is correct |
38 |
Correct |
98 ms |
306516 KB |
Output is correct |
39 |
Correct |
77 ms |
306516 KB |
Output is correct |
40 |
Correct |
102 ms |
306524 KB |
Output is correct |
41 |
Correct |
77 ms |
306460 KB |
Output is correct |
42 |
Correct |
100 ms |
306512 KB |
Output is correct |
43 |
Correct |
100 ms |
306516 KB |
Output is correct |
44 |
Correct |
94 ms |
306512 KB |
Output is correct |
45 |
Correct |
531 ms |
308564 KB |
Output is correct |
46 |
Correct |
528 ms |
307788 KB |
Output is correct |
47 |
Correct |
577 ms |
308636 KB |
Output is correct |
48 |
Correct |
545 ms |
308560 KB |
Output is correct |
49 |
Correct |
364 ms |
307516 KB |
Output is correct |
50 |
Correct |
391 ms |
309200 KB |
Output is correct |
51 |
Correct |
538 ms |
308560 KB |
Output is correct |
52 |
Correct |
419 ms |
307540 KB |
Output is correct |
53 |
Correct |
342 ms |
307460 KB |
Output is correct |
54 |
Correct |
262 ms |
306804 KB |
Output is correct |
55 |
Correct |
381 ms |
309072 KB |
Output is correct |
56 |
Correct |
455 ms |
307244 KB |
Output is correct |
57 |
Correct |
372 ms |
307536 KB |
Output is correct |
58 |
Correct |
931 ms |
307796 KB |
Output is correct |
59 |
Correct |
458 ms |
307384 KB |
Output is correct |
60 |
Correct |
464 ms |
307280 KB |
Output is correct |
61 |
Correct |
885 ms |
307796 KB |
Output is correct |
62 |
Correct |
671 ms |
307544 KB |
Output is correct |
63 |
Correct |
529 ms |
307792 KB |
Output is correct |
64 |
Correct |
458 ms |
307304 KB |
Output is correct |
65 |
Correct |
555 ms |
308052 KB |
Output is correct |
66 |
Correct |
708 ms |
307832 KB |
Output is correct |
67 |
Correct |
527 ms |
307796 KB |
Output is correct |
68 |
Correct |
517 ms |
308052 KB |
Output is correct |
69 |
Correct |
576 ms |
308076 KB |
Output is correct |
70 |
Correct |
516 ms |
307588 KB |
Output is correct |
71 |
Correct |
562 ms |
308052 KB |
Output is correct |
72 |
Correct |
465 ms |
307720 KB |
Output is correct |
73 |
Correct |
529 ms |
308308 KB |
Output is correct |
74 |
Correct |
470 ms |
307536 KB |
Output is correct |
75 |
Correct |
285 ms |
307304 KB |
Output is correct |
76 |
Correct |
435 ms |
307720 KB |
Output is correct |
77 |
Correct |
525 ms |
308304 KB |
Output is correct |
78 |
Correct |
283 ms |
307284 KB |
Output is correct |
79 |
Correct |
284 ms |
307300 KB |
Output is correct |
80 |
Correct |
159 ms |
306776 KB |
Output is correct |
81 |
Correct |
280 ms |
307284 KB |
Output is correct |
82 |
Correct |
516 ms |
308048 KB |
Output is correct |
83 |
Correct |
155 ms |
306792 KB |
Output is correct |
84 |
Correct |
502 ms |
308144 KB |
Output is correct |