Submission #687856

#TimeUsernameProblemLanguageResultExecution timeMemory
6878562vasBurza (COCI16_burza)C++17
0 / 160
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; void solve(); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t=1; // cin >> t; while(t--) { solve(); } return 0; } int n, k; const int MXN = 400; vector<int> edges[MXN]; bool dfs(int i, int parent, int depth) { if (depth >= k) return false; bool alreadyChildFalse = false; for (int v : edges[i]) { if (v == parent) continue; if (dfs(v, i, depth+1)) continue; if (alreadyChildFalse) return false; alreadyChildFalse = true; } return true; } void solve() { cin >> n >> k; for (int i = 0; i < n - 1; i++) { int x, y; cin >> x >> y; x--; y--; edges[x].push_back(y); edges[y].push_back(x); } if (dfs(0, -1, 0)) { cout << "DA" << endl; } else { cout << "NE" << endl; } }
#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...