# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
964126 | 2024-04-16T10:49:23 Z | Batorgil952 | Burza (COCI16_burza) | C++14 | 1 ms | 600 KB |
#include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair using namespace std; const int N=402; vector< int > v[N]; int dp[N]; bool B[N]; void DFS(int p){ int un, vn; vector< int > u; vn=v[p].size(); for(int i=0; i<vn; i++){ if(!B[v[p][i]]){ B[v[p][i]]=true; DFS(v[p][i]); u.pb(dp[v[p][i]]); } } un=u.size(); if(un==0) dp[p] = 0; else if (un==1) dp[p]=1; else{ sort(u.begin(), u.end()); dp[p]=u[un-2]+1; } } int main(){ int n, k, i, x, y; scanf("%d",&n); scanf("%d",&k); for(i=1; i<n; i++){ scanf("%d",&x); scanf("%d",&y); v[x].pb(y); v[y].pb(x); } B[1]=true; DFS(1); if(dp[1]>k) printf("NE\n"); else printf("DA\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 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 | 0 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 448 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 | - |