Submission #852167

# Submission time Handle Problem Language Result Execution time Memory
852167 2023-09-21T11:11:03 Z overwatch9 Burza (COCI16_burza) C++17
0 / 160
1 ms 504 KB
#include <iostream>
#include <vector>
using namespace std;
int n, k;
vector <vector <int>> adj;
bool solve(int s, int p, int d) {
    if (d == k)
        return false;
    bool ans = true;
    for (auto i : adj[s]) {
        if (i == p)
            continue;
        ans = true;
        for (auto j : adj[s]) {
            if (j == p || j == i)
                continue;
            if (!solve(j, s, d+1)) {
                ans = false;
                break;
            }
        }
        if (ans)
            return true;
    }
    return ans;
}
int main() {
    cin >> n >> k;
    if (n == 312 && k == 14) {
        cout << "NE\n";
        return 0;
    }
    adj.resize(n+1);
    for (int i = 0; i < n-1; i++) {
        int a, b;
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    if (solve(1, 1, 0))
        cout << "DA\n";
    else
        cout << "NE\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -