Submission #646013

#TimeUsernameProblemLanguageResultExecution timeMemory
646013KarukBurza (COCI16_burza)C++14
0 / 160
1 ms312 KiB
#include<bits/stdc++.h> using namespace std; int n,k; bool flag[401]; bool used[401]; vector<int>a[401]; void dfs(int n,int depth=0) { used[n]=1; if(depth==k){flag[n]=1;return;} int cnt=0; for(int i:a[n]) { if(!used[i]){dfs(i,depth+1);cnt+=flag[i];} } if(cnt>1)flag[n]=1; } int main() { cin>>n>>k; for(int i=0;i<n-1;i++) { int x,y;cin>>x>>y; a[x].push_back(y); a[y].push_back(x); } dfs(1); if(flag[1])cout<<"NE"<<endl; else cout<<"DA"<<endl; 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...