Submission #967857

# Submission time Handle Problem Language Result Execution time Memory
967857 2024-04-23T03:00:48 Z 12345678 Burza (COCI16_burza) C++17
0 / 160
1 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=405;

int n, k, u, v, dp[nx], s[nx];
vector<int> d[nx];

void dfs(int u, int p)
{

}

void solve(int u, int p)
{
    if (d[u].size()==1) return s[u]=1, void();
    pair<int, int> mx;
    for (auto v:d[u]) if (v!=p) solve(v, u), mx=max(mx, {s[v], v});
    pair<int, int> mx2;
    for (auto v:d[u]) if (v!=p&&v!=mx.second) mx2=max(mx2, {s[v], v});
    if (mx2.first!=0) s[u]=mx2.first+1;
    else s[u]=1;
}

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>k;
    for (int i=1; i<n; i++) cin>>u>>v, d[u].push_back(v), d[v].push_back(u);
    solve(1, 1);
    if (s[1]>k) cout<<"NE";
    else cout<<"DA";
}
# 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 344 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 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -