Submission #396784

# Submission time Handle Problem Language Result Execution time Memory
396784 2021-04-30T18:11:32 Z NothingXD Burza (COCI16_burza) C++17
0 / 160
3 ms 2640 KB
/*
You know, I've been around for a while now.
Not sure if I have much left to prove.
Yeah I do, haha!!
*/

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define endl               '\n'
#define F                  first
#define S                  second
#define debug(x)           cerr << #x << " = " << x << endl
#define all(x)             x.begin(), x.end()
#define pb                 push_back
#define ppb                pop_back
#define MP                 make_pair

const int MAXN = 1e5 + 10;

int T, n, k;
vector<int> g[MAXN];
bool visited[MAXN];

int dfs(int v, int x){
    visited[v] = true;
    int cnt = 0;
    if (x == 0) return 1;
    for (auto u: g[v]){
        if (!visited[u]){
            cnt += dfs(u, x-1);
        }
    }
    return (cnt > 1? 1: 0);
}

int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    T = 1;
//    cin >> T;
    while(T--){
        cin >> n >> k;
        for (int i = 1; i < n; i++){
            int u, v; cin >> u >> v;
            g[u].pb(v);
            g[v].pb(u);
        }
        cout << (dfs(1, k)?"NE":"DA");
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2636 KB Output isn't correct
2 Halted 0 ms 0 KB -