Submission #807295

#TimeUsernameProblemLanguageResultExecution timeMemory
807295tch1cherinPolitical Development (BOI17_politicaldevelopment)C++17
16 / 100
34 ms25292 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...