Submission #885175

#TimeUsernameProblemLanguageResultExecution timeMemory
885175PieArmyBurza (COCI16_burza)C++17
0 / 160
1 ms600 KiB
#include <bits/stdc++.h> typedef long long ll; #define yem(re) (1ll<<(ll(re))) #define endl '\n' #define pb push_back #define int long long #define mid ((left+right)/2) #define L(emanuelLasker,joseRaulCapablanca,anatolyKarpov) for(int emanuelLasker=(joseRaulCapablanca);emanuelLasker<=(anatolyKarpov);emanuelLasker++) #define R(magnusCarlsen,paulMorphy,bobbyFischer) for(int magnusCarlsen=(paulMorphy);magnusCarlsen>=(bobbyFischer);magnusCarlsen--) #define cint(vladimirKramnik) int vladimirKramnik;cin>>vladimirKramnik #define inf (2e18+5) #define sc second #define fr first #define Bismillahirrahmanirrahim ios_base::sync_with_stdio(false);cin.tie(NULL); #define cinarr(mikhailTal) for(auto &garryKasparov:mikhailTal)cin>>garryKasparov; #define all(mustafaKemalAtaturk) mustafaKemalAtaturk.begin(),mustafaKemalAtaturk.end() using namespace std; mt19937 rng(chrono::high_resolution_clock().now().time_since_epoch().count()); int32_t main(){ Bismillahirrahmanirrahim int n,k;cin>>n>>k; vector<vector<int>>komsu(n,vector<int>(0)); L(i,1,n-1){ cint(x);cint(y); x--;y--; komsu[x].pb(y); komsu[y].pb(x); } function<int(int,int,int)>f=[&](int pos,int root,int dep)->int{ if(dep==k)return 1; multiset<int>st; for(int x:komsu[pos]){ if(x==root)continue; st.insert(-f(x,pos,dep+1)); } if(st.size()==0)return 0; int x=(*st.begin())+1; st.erase(st.begin()); st.insert(x); return max(0ll,-(*st.begin())); }; int ans=f(0,0,0); if(ans)cout<<"NE"; else cout<<"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...