Submission #661052

#TimeUsernameProblemLanguageResultExecution timeMemory
661052ono_de206Burza (COCI16_burza)C++14
0 / 160
1 ms360 KiB
#include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define in insert #define all(x) x.begin(),x.end() #define pb push_back #define eb emplace_back #define ff first #define ss second typedef long long ll; //#define int long long template<typename T> void mxx(T &a, T b){if(b>a) a=b;} template<typename T> void mnn(T &a, T b){if(b<a) a=b;} const int mxn=410; int dp[mxn]; vector<int> g[mxn]; void dfs(int to,int fr){ // if(to==1) dp[to]=0; // else dp[to]=1; dp[to]=1; vector<int> lol; for(int x : g[to]){ if(x==fr) continue; dfs(x,to); lol.pb(dp[x]); } sort(all(lol)); if(lol.size()>1) dp[to]+=lol[lol.size()-2]; } signed main(){ fast; int n,k; cin>>n>>k; for(int i=0; i<n-1; i++){ int a,b; cin>>a>>b; g[a].pb(b); g[b].pb(a); } dfs(1,0); if(dp[1]>k) cout<<"NE\n"; else cout<<"DA\n"; 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...