#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;
int maxClique(int i)
{
cur = adj[i];
int last = i;
int cnt = 0;
while(true)
{
cnt++;
cur&=adj[last];
int before = last;
for(int j = cur._Find_first() ; j < N ; j = cur._Find_next(j))
{
if(done[j])
continue;
last = j;
break;
}
if(before == last)
break;
}
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;
random_shuffle(p.begin() , p.end());
fore(i , n)
{
best = max(best , maxClique(p[i]));
done[p[i]] = 1;
}
cout<<best<<nl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
306256 KB |
Output is correct |
2 |
Correct |
86 ms |
306340 KB |
Output is correct |
3 |
Correct |
99 ms |
306516 KB |
Output is correct |
4 |
Correct |
115 ms |
306512 KB |
Output is correct |
5 |
Correct |
91 ms |
306432 KB |
Output is correct |
6 |
Correct |
93 ms |
306512 KB |
Output is correct |
7 |
Correct |
93 ms |
306608 KB |
Output is correct |
8 |
Correct |
94 ms |
306512 KB |
Output is correct |
9 |
Correct |
86 ms |
306368 KB |
Output is correct |
10 |
Correct |
89 ms |
306512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
306256 KB |
Output is correct |
2 |
Correct |
86 ms |
306340 KB |
Output is correct |
3 |
Correct |
99 ms |
306516 KB |
Output is correct |
4 |
Correct |
115 ms |
306512 KB |
Output is correct |
5 |
Correct |
91 ms |
306432 KB |
Output is correct |
6 |
Correct |
93 ms |
306512 KB |
Output is correct |
7 |
Correct |
93 ms |
306608 KB |
Output is correct |
8 |
Correct |
94 ms |
306512 KB |
Output is correct |
9 |
Correct |
86 ms |
306368 KB |
Output is correct |
10 |
Correct |
89 ms |
306512 KB |
Output is correct |
11 |
Correct |
99 ms |
306516 KB |
Output is correct |
12 |
Correct |
92 ms |
306512 KB |
Output is correct |
13 |
Correct |
85 ms |
306260 KB |
Output is correct |
14 |
Correct |
98 ms |
306516 KB |
Output is correct |
15 |
Correct |
86 ms |
306256 KB |
Output is correct |
16 |
Correct |
111 ms |
306432 KB |
Output is correct |
17 |
Correct |
87 ms |
306260 KB |
Output is correct |
18 |
Correct |
92 ms |
306512 KB |
Output is correct |
19 |
Correct |
94 ms |
306516 KB |
Output is correct |
20 |
Correct |
94 ms |
306452 KB |
Output is correct |
21 |
Correct |
98 ms |
306516 KB |
Output is correct |
22 |
Correct |
92 ms |
306516 KB |
Output is correct |
23 |
Incorrect |
98 ms |
306444 KB |
Output isn't correct |
24 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
306516 KB |
Output is correct |
2 |
Correct |
87 ms |
306260 KB |
Output is correct |
3 |
Correct |
84 ms |
306328 KB |
Output is correct |
4 |
Incorrect |
86 ms |
306428 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
306256 KB |
Output is correct |
2 |
Correct |
86 ms |
306340 KB |
Output is correct |
3 |
Correct |
99 ms |
306516 KB |
Output is correct |
4 |
Correct |
115 ms |
306512 KB |
Output is correct |
5 |
Correct |
91 ms |
306432 KB |
Output is correct |
6 |
Correct |
93 ms |
306512 KB |
Output is correct |
7 |
Correct |
93 ms |
306608 KB |
Output is correct |
8 |
Correct |
94 ms |
306512 KB |
Output is correct |
9 |
Correct |
86 ms |
306368 KB |
Output is correct |
10 |
Correct |
89 ms |
306512 KB |
Output is correct |
11 |
Correct |
99 ms |
306516 KB |
Output is correct |
12 |
Correct |
92 ms |
306512 KB |
Output is correct |
13 |
Correct |
85 ms |
306260 KB |
Output is correct |
14 |
Correct |
98 ms |
306516 KB |
Output is correct |
15 |
Correct |
86 ms |
306256 KB |
Output is correct |
16 |
Correct |
111 ms |
306432 KB |
Output is correct |
17 |
Correct |
87 ms |
306260 KB |
Output is correct |
18 |
Correct |
92 ms |
306512 KB |
Output is correct |
19 |
Correct |
94 ms |
306516 KB |
Output is correct |
20 |
Correct |
94 ms |
306452 KB |
Output is correct |
21 |
Correct |
98 ms |
306516 KB |
Output is correct |
22 |
Correct |
92 ms |
306516 KB |
Output is correct |
23 |
Incorrect |
98 ms |
306444 KB |
Output isn't correct |
24 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
306256 KB |
Output is correct |
2 |
Correct |
86 ms |
306340 KB |
Output is correct |
3 |
Correct |
99 ms |
306516 KB |
Output is correct |
4 |
Correct |
115 ms |
306512 KB |
Output is correct |
5 |
Correct |
91 ms |
306432 KB |
Output is correct |
6 |
Correct |
93 ms |
306512 KB |
Output is correct |
7 |
Correct |
93 ms |
306608 KB |
Output is correct |
8 |
Correct |
94 ms |
306512 KB |
Output is correct |
9 |
Correct |
86 ms |
306368 KB |
Output is correct |
10 |
Correct |
89 ms |
306512 KB |
Output is correct |
11 |
Correct |
99 ms |
306516 KB |
Output is correct |
12 |
Correct |
92 ms |
306512 KB |
Output is correct |
13 |
Correct |
85 ms |
306260 KB |
Output is correct |
14 |
Correct |
98 ms |
306516 KB |
Output is correct |
15 |
Correct |
86 ms |
306256 KB |
Output is correct |
16 |
Correct |
111 ms |
306432 KB |
Output is correct |
17 |
Correct |
87 ms |
306260 KB |
Output is correct |
18 |
Correct |
92 ms |
306512 KB |
Output is correct |
19 |
Correct |
94 ms |
306516 KB |
Output is correct |
20 |
Correct |
94 ms |
306452 KB |
Output is correct |
21 |
Correct |
98 ms |
306516 KB |
Output is correct |
22 |
Correct |
92 ms |
306516 KB |
Output is correct |
23 |
Incorrect |
98 ms |
306444 KB |
Output isn't correct |
24 |
Halted |
0 ms |
0 KB |
- |