Submission #827428

# Submission time Handle Problem Language Result Execution time Memory
827428 2023-08-16T13:04:05 Z SoulKnight Burza (COCI16_burza) C++17
0 / 160
1 ms 340 KB
#include "bits/stdc++.h"
using namespace std;

#define ll long long
#define ln '\n'

const int N = 400 + 5;
const int LG = 21;
const ll INF = 5e18;
const int MOD = 998244353;

vector<int> adj[N];

bool f(int u, int p, int k){
    if (k == 0) return 0;
    int cnt = 0;

    for (auto& v: adj[u]){
        if (v == p) continue;
        cnt += (!f(v, u, k-1));
    }

    return (cnt < 2);
}

void solve(){
    int n, k; cin >> n >> k;
    for (int i = 0; i < n-1; i++){
        int u, v; cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    cout << ((f(1, -1, k))? "DA": "NE") << ln;
}




int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    // freopen("mooyomooyo.in", "r", stdin);
    // freopen("mooyomooyo.out", "w", stdout);


    // ll T; cin >> T;
    // while (T--){
    //     solve();
    // }

    // init();
    solve();

    return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 336 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 332 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 336 KB Output isn't correct
2 Halted 0 ms 0 KB -