#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n, k;
cin >> n >> k;
vector<int> E[n];
vector<vector<bool>> vis(n, vector<bool>(n));
for (int i = 0; i < n; i++) {
int d;
cin >> d;
while (d--) {
int y;
cin >> y;
vis[i][y] = true;
E[i].push_back(y);
}
}
int mx = 1;
for (int i = 0; i < n; i++) {
for (auto j : E[i]) {
if (!vis[j][i]) continue;
mx = max(mx, 2);
for (auto k : E[i])
if (vis[k][i] && vis[k][j]) mx = max(mx, 3);
}
}
cout << mx;
}
# | 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... |