Submission #646013

# Submission time Handle Problem Language Result Execution time Memory
646013 2022-09-28T13:45:17 Z Karuk Burza (COCI16_burza) C++14
0 / 160
1 ms 312 KB
#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 time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -