Submission #396779

#TimeUsernameProblemLanguageResultExecution timeMemory
396779NothingXDBurza (COCI16_burza)C++14
0 / 160
3 ms2764 KiB
/* You know, I've been around for a while now. Not sure if I have much left to prove. Yeah I do, haha!! */ #include<bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' #define F first #define S second #define debug(x) cerr << #x << " = " << x << endl #define all(x) x.begin(), x.end() #define pb push_back #define ppb pop_back #define MP make_pair const int MAXN = 1e5 + 10; int T, n, k; vector<int> g[MAXN]; bool visited[MAXN]; int dfs(int v, int x){ visited[v] = true; int cnt = 0; if (x == 0) return 1; for (auto u: g[v]){ if (!visited[u]){ cnt += dfs(u, x-1); } } return (cnt > 1? 1: 0); } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); T = 1; // cin >> T; while(T--){ cin >> n >> k; for (int i = 1; i < n; i++){ int u, v; cin >> u >> v; g[u].pb(v); g[v].pb(u); } cout << (dfs(1, k)?"NE":"DA"); } 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...