Submission #827428

#TimeUsernameProblemLanguageResultExecution timeMemory
827428SoulKnightBurza (COCI16_burza)C++17
0 / 160
1 ms340 KiB
#include "bits/stdc++.h" using namespace std; #define ll long long #define ln '\n' const int N = 400 + 5; const int LG = 21; const ll INF = 5e18; const int MOD = 998244353; vector<int> adj[N]; bool f(int u, int p, int k){ if (k == 0) return 0; int cnt = 0; for (auto& v: adj[u]){ if (v == p) continue; cnt += (!f(v, u, k-1)); } return (cnt < 2); } void solve(){ int n, k; cin >> n >> k; for (int i = 0; i < n-1; i++){ int u, v; cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } cout << ((f(1, -1, k))? "DA": "NE") << ln; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); // freopen("mooyomooyo.in", "r", stdin); // freopen("mooyomooyo.out", "w", stdout); // ll T; cin >> T; // while (T--){ // solve(); // } // init(); solve(); return 0; }
#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...