# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
537322 |
2022-03-15T01:19:18 Z |
MinhAnhnd |
Burza (COCI16_burza) |
C++14 |
|
1 ms |
360 KB |
#include <bits/stdc++.h>
#include <iostream>
#define ll long long
#define ull unsigned ll
using namespace std;
vector<long> branches[401];
vector<long> children[401];
long parents[401];
long N,K;
long dp[401]={};
long depth = -1;
void dfs(long u,long parent){
depth++;
parents[u] = parent;
for (auto v:branches[u]){
if (v!=parent){
children[u].push_back(v);
dfs(v,u);
}
}
if (depth==K){
dp[u] = LONG_MAX;
}
else if (children[u].size()<2){
dp[u] = 0;
}
else{
//sort(children[u].begin(),children[u].end(),greater<>());
for (auto v:children[u]){
if (dp[v] != 0) dp[u]++;
}
if (dp[u]!=0) dp[u]--;
}
depth--;
return;
}
int main(){
cin>>N>>K;
for(long i = 1;i<=N-1;i++){
long u,v;
cin>>u>>v;
branches[u].push_back(v);
branches[v].push_back(u);
}
dfs(1,-1);
if (dp[1] == 0) cout<<"DA"; else cout<<"NE";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
328 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
328 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
328 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |