Submission #396641

#TimeUsernameProblemLanguageResultExecution timeMemory
396641ArinoorBurza (COCI16_burza)C++17
0 / 160
3 ms2672 KiB
#include <iostream> #include <vector> #include <queue> #include <set> #include <map> #include <algorithm> #include <cstring> #define mp make_pair #define ios ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define bug(str, x) cerr << "# " << str << " : " << x << '\n' #define here(x) cerr << "here " << x << '\n' using namespace std; typedef long long ll; const int maxn = 1e5 + 10; const int inf = 1e9; int n, k; vector<int> G[maxn]; bool dfs(int v, int p, int h){ if(h == k){ return true; } int res = 0; for(int u : G[v]){ if(u != p){ res += dfs(u, v, h + 1); } } return res > 1; } int main(){ ios; cin >> n >> k; for(int i = 0; i < n - 1; i ++){ int u, v; cin >> u >> v; G[--u].push_back(--v); G[v].push_back(u); } cout << (dfs(0, -1, 0) ? "NE" : "DA"); }
#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...