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 MAX_N = 5005;
bool adj[MAX_N][MAX_N] = {};
int main() {
int N, K;
cin >> N >> K;
bool good = false;
vector<vector<int>> G(N);
for (int i = 0; i < N; i++) {
int d;
cin >> d;
if (d != 0) {
good = true;
}
G[i].resize(d);
for (int j = 0; j < d; j++) {
cin >> G[i][j];
adj[i][G[i][j]] = true;
}
}
if (K == 3) {
for (int i = 0; i < N; i++)
for (int j : G[i])
for (int k : G[j])
if (adj[i][k]) {
cout << 3 << "\n";
exit(0);
}
}
cout << (good && K >= 2 ? 2 : 1) << "\n";
}
# | 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... |