#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--)
const int N = 50000;
vector<bitset<N>> adj(N , 0);
bool done[N];
int n , k;
bitset<N> cur = 0;
bitset<N> vis = 0;
int maxClique(int i)
{
vis = 0;
vis[i] = 1;
cur = adj[i];
int last = i;
int cnt = 0;
while(cnt < k)
{
cnt++;
cur&=adj[last];
if(cur == 0)
break;
int before = last;
for(int j = cur._Find_first() ; j < N ; j = cur._Find_next(i))
{
if(done[j] || vis[j])
continue;
last = j;
break;
}
if(before == last)
break;
vis[last] = 1;
}
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;
adj[i][x] = 1;
}
}
int best = 0;
fore(i , n)
{
best = max(best , maxClique(i));
done[i] = 1;
}
cout<<best<<nl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
85 ms |
306512 KB |
Output is correct |
2 |
Correct |
87 ms |
306332 KB |
Output is correct |
3 |
Correct |
94 ms |
306516 KB |
Output is correct |
4 |
Correct |
114 ms |
306416 KB |
Output is correct |
5 |
Correct |
96 ms |
306284 KB |
Output is correct |
6 |
Correct |
92 ms |
306516 KB |
Output is correct |
7 |
Correct |
92 ms |
306512 KB |
Output is correct |
8 |
Correct |
93 ms |
306512 KB |
Output is correct |
9 |
Correct |
82 ms |
306388 KB |
Output is correct |
10 |
Correct |
94 ms |
306512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
85 ms |
306512 KB |
Output is correct |
2 |
Correct |
87 ms |
306332 KB |
Output is correct |
3 |
Correct |
94 ms |
306516 KB |
Output is correct |
4 |
Correct |
114 ms |
306416 KB |
Output is correct |
5 |
Correct |
96 ms |
306284 KB |
Output is correct |
6 |
Correct |
92 ms |
306516 KB |
Output is correct |
7 |
Correct |
92 ms |
306512 KB |
Output is correct |
8 |
Correct |
93 ms |
306512 KB |
Output is correct |
9 |
Correct |
82 ms |
306388 KB |
Output is correct |
10 |
Correct |
94 ms |
306512 KB |
Output is correct |
11 |
Correct |
92 ms |
306516 KB |
Output is correct |
12 |
Correct |
96 ms |
306512 KB |
Output is correct |
13 |
Correct |
87 ms |
306312 KB |
Output is correct |
14 |
Correct |
95 ms |
306512 KB |
Output is correct |
15 |
Correct |
87 ms |
306516 KB |
Output is correct |
16 |
Correct |
93 ms |
306520 KB |
Output is correct |
17 |
Correct |
84 ms |
306512 KB |
Output is correct |
18 |
Correct |
95 ms |
306512 KB |
Output is correct |
19 |
Correct |
89 ms |
306468 KB |
Output is correct |
20 |
Correct |
98 ms |
306512 KB |
Output is correct |
21 |
Correct |
98 ms |
306512 KB |
Output is correct |
22 |
Correct |
91 ms |
306516 KB |
Output is correct |
23 |
Correct |
121 ms |
306392 KB |
Output is correct |
24 |
Correct |
89 ms |
306512 KB |
Output is correct |
25 |
Correct |
98 ms |
306512 KB |
Output is correct |
26 |
Correct |
95 ms |
306336 KB |
Output is correct |
27 |
Correct |
93 ms |
306512 KB |
Output is correct |
28 |
Correct |
100 ms |
306512 KB |
Output is correct |
29 |
Correct |
111 ms |
306512 KB |
Output is correct |
30 |
Correct |
93 ms |
306512 KB |
Output is correct |
31 |
Correct |
94 ms |
306512 KB |
Output is correct |
32 |
Correct |
95 ms |
306488 KB |
Output is correct |
33 |
Correct |
94 ms |
306464 KB |
Output is correct |
34 |
Correct |
97 ms |
306376 KB |
Output is correct |
35 |
Correct |
88 ms |
306504 KB |
Output is correct |
36 |
Correct |
97 ms |
306396 KB |
Output is correct |
37 |
Correct |
106 ms |
306512 KB |
Output is correct |
38 |
Correct |
87 ms |
306512 KB |
Output is correct |
39 |
Correct |
88 ms |
306512 KB |
Output is correct |
40 |
Correct |
93 ms |
306516 KB |
Output is correct |
41 |
Correct |
85 ms |
306468 KB |
Output is correct |
42 |
Correct |
97 ms |
306516 KB |
Output is correct |
43 |
Correct |
95 ms |
306516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
95 ms |
306492 KB |
Output is correct |
2 |
Correct |
84 ms |
306512 KB |
Output is correct |
3 |
Correct |
82 ms |
306304 KB |
Output is correct |
4 |
Correct |
82 ms |
306512 KB |
Output is correct |
5 |
Incorrect |
87 ms |
306516 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
85 ms |
306512 KB |
Output is correct |
2 |
Correct |
87 ms |
306332 KB |
Output is correct |
3 |
Correct |
94 ms |
306516 KB |
Output is correct |
4 |
Correct |
114 ms |
306416 KB |
Output is correct |
5 |
Correct |
96 ms |
306284 KB |
Output is correct |
6 |
Correct |
92 ms |
306516 KB |
Output is correct |
7 |
Correct |
92 ms |
306512 KB |
Output is correct |
8 |
Correct |
93 ms |
306512 KB |
Output is correct |
9 |
Correct |
82 ms |
306388 KB |
Output is correct |
10 |
Correct |
94 ms |
306512 KB |
Output is correct |
11 |
Correct |
92 ms |
306516 KB |
Output is correct |
12 |
Correct |
96 ms |
306512 KB |
Output is correct |
13 |
Correct |
87 ms |
306312 KB |
Output is correct |
14 |
Correct |
95 ms |
306512 KB |
Output is correct |
15 |
Correct |
87 ms |
306516 KB |
Output is correct |
16 |
Correct |
93 ms |
306520 KB |
Output is correct |
17 |
Correct |
84 ms |
306512 KB |
Output is correct |
18 |
Correct |
95 ms |
306512 KB |
Output is correct |
19 |
Correct |
89 ms |
306468 KB |
Output is correct |
20 |
Correct |
98 ms |
306512 KB |
Output is correct |
21 |
Correct |
98 ms |
306512 KB |
Output is correct |
22 |
Correct |
91 ms |
306516 KB |
Output is correct |
23 |
Correct |
121 ms |
306392 KB |
Output is correct |
24 |
Correct |
89 ms |
306512 KB |
Output is correct |
25 |
Correct |
98 ms |
306512 KB |
Output is correct |
26 |
Correct |
95 ms |
306336 KB |
Output is correct |
27 |
Correct |
93 ms |
306512 KB |
Output is correct |
28 |
Correct |
100 ms |
306512 KB |
Output is correct |
29 |
Correct |
111 ms |
306512 KB |
Output is correct |
30 |
Correct |
93 ms |
306512 KB |
Output is correct |
31 |
Correct |
94 ms |
306512 KB |
Output is correct |
32 |
Correct |
95 ms |
306488 KB |
Output is correct |
33 |
Correct |
94 ms |
306464 KB |
Output is correct |
34 |
Correct |
97 ms |
306376 KB |
Output is correct |
35 |
Correct |
88 ms |
306504 KB |
Output is correct |
36 |
Correct |
97 ms |
306396 KB |
Output is correct |
37 |
Correct |
106 ms |
306512 KB |
Output is correct |
38 |
Correct |
87 ms |
306512 KB |
Output is correct |
39 |
Correct |
88 ms |
306512 KB |
Output is correct |
40 |
Correct |
93 ms |
306516 KB |
Output is correct |
41 |
Correct |
85 ms |
306468 KB |
Output is correct |
42 |
Correct |
97 ms |
306516 KB |
Output is correct |
43 |
Correct |
95 ms |
306516 KB |
Output is correct |
44 |
Correct |
105 ms |
306296 KB |
Output is correct |
45 |
Correct |
89 ms |
306312 KB |
Output is correct |
46 |
Incorrect |
99 ms |
306384 KB |
Output isn't correct |
47 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
85 ms |
306512 KB |
Output is correct |
2 |
Correct |
87 ms |
306332 KB |
Output is correct |
3 |
Correct |
94 ms |
306516 KB |
Output is correct |
4 |
Correct |
114 ms |
306416 KB |
Output is correct |
5 |
Correct |
96 ms |
306284 KB |
Output is correct |
6 |
Correct |
92 ms |
306516 KB |
Output is correct |
7 |
Correct |
92 ms |
306512 KB |
Output is correct |
8 |
Correct |
93 ms |
306512 KB |
Output is correct |
9 |
Correct |
82 ms |
306388 KB |
Output is correct |
10 |
Correct |
94 ms |
306512 KB |
Output is correct |
11 |
Correct |
92 ms |
306516 KB |
Output is correct |
12 |
Correct |
96 ms |
306512 KB |
Output is correct |
13 |
Correct |
87 ms |
306312 KB |
Output is correct |
14 |
Correct |
95 ms |
306512 KB |
Output is correct |
15 |
Correct |
87 ms |
306516 KB |
Output is correct |
16 |
Correct |
93 ms |
306520 KB |
Output is correct |
17 |
Correct |
84 ms |
306512 KB |
Output is correct |
18 |
Correct |
95 ms |
306512 KB |
Output is correct |
19 |
Correct |
89 ms |
306468 KB |
Output is correct |
20 |
Correct |
98 ms |
306512 KB |
Output is correct |
21 |
Correct |
98 ms |
306512 KB |
Output is correct |
22 |
Correct |
91 ms |
306516 KB |
Output is correct |
23 |
Correct |
121 ms |
306392 KB |
Output is correct |
24 |
Correct |
89 ms |
306512 KB |
Output is correct |
25 |
Correct |
98 ms |
306512 KB |
Output is correct |
26 |
Correct |
95 ms |
306336 KB |
Output is correct |
27 |
Correct |
93 ms |
306512 KB |
Output is correct |
28 |
Correct |
100 ms |
306512 KB |
Output is correct |
29 |
Correct |
111 ms |
306512 KB |
Output is correct |
30 |
Correct |
93 ms |
306512 KB |
Output is correct |
31 |
Correct |
94 ms |
306512 KB |
Output is correct |
32 |
Correct |
95 ms |
306488 KB |
Output is correct |
33 |
Correct |
94 ms |
306464 KB |
Output is correct |
34 |
Correct |
97 ms |
306376 KB |
Output is correct |
35 |
Correct |
88 ms |
306504 KB |
Output is correct |
36 |
Correct |
97 ms |
306396 KB |
Output is correct |
37 |
Correct |
106 ms |
306512 KB |
Output is correct |
38 |
Correct |
87 ms |
306512 KB |
Output is correct |
39 |
Correct |
88 ms |
306512 KB |
Output is correct |
40 |
Correct |
93 ms |
306516 KB |
Output is correct |
41 |
Correct |
85 ms |
306468 KB |
Output is correct |
42 |
Correct |
97 ms |
306516 KB |
Output is correct |
43 |
Correct |
95 ms |
306516 KB |
Output is correct |
44 |
Correct |
86 ms |
306476 KB |
Output is correct |
45 |
Incorrect |
237 ms |
306484 KB |
Output isn't correct |
46 |
Halted |
0 ms |
0 KB |
- |