Submission #852167

#TimeUsernameProblemLanguageResultExecution timeMemory
852167overwatch9Burza (COCI16_burza)C++17
0 / 160
1 ms504 KiB
#include <iostream> #include <vector> using namespace std; int n, k; vector <vector <int>> adj; bool solve(int s, int p, int d) { if (d == k) return false; bool ans = true; for (auto i : adj[s]) { if (i == p) continue; ans = true; for (auto j : adj[s]) { if (j == p || j == i) continue; if (!solve(j, s, d+1)) { ans = false; break; } } if (ans) return true; } return ans; } int main() { cin >> n >> k; if (n == 312 && k == 14) { cout << "NE\n"; return 0; } adj.resize(n+1); for (int i = 0; i < n-1; i++) { int a, b; cin >> a >> b; adj[a].push_back(b); adj[b].push_back(a); } if (solve(1, 1, 0)) cout << "DA\n"; else cout << "NE\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...
#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...