This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int nmax = 5e4 + 2;
vector<int> adj[nmax];
bitset<nmax> f1[nmax], f2[nmax];
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
for(int i = 1; i <= n; i++) {
int d;
cin >> d;
f1[i][i] = f2[i][i] = 1;
while(d--) {
int j;
cin >> j;
j++;
adj[i].push_back(j);
f1[i][j] = 1;
f2[i][j] = 1;
}
}
int ans = 0;
for(int i = 1; i <= n; i++) {
for(auto it : adj[i]) {
f2[i] = (f2[i] & f1[it]);
}
ans = max(ans, (int) f2[i].count());
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |