Submission #783704

#TimeUsernameProblemLanguageResultExecution timeMemory
7837048pete8Burza (COCI16_burza)C++14
0 / 160
1 ms340 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<limits.h> #include<cmath> #include<set> #include<algorithm> #include<bitset> using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define ppii pair<pii,pii> #define pb push_back #define p push #define fastio ios::sync_with_stdio(false);cin.tie(NULL); using namespace std; const int mxn=404; vector<int>adj[mxn+10]; int moves[mxn+10],n,k; void solve(int cur,int p){ vector<int>v; for(auto i:adj[cur]){ if(i==p)continue; solve(i,cur); v.pb(moves[i]); } sort(v.begin(),v.end()); if(v.size()<=1)moves[cur]=1; else moves[cur]=v[v.size()-2]+1; } int32_t main(){ fastio cin>>n>>k; for(int i=0;i<n-1;i++){ int a,b;cin>>a>>b; adj[a].pb(b); adj[b].pb(a); } solve(1,-1); cout<<((moves[1]-1>=k)?"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...