# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31795 | 2017-09-09T04:58:51 Z | top34051 | Burza (COCI16_burza) | C++14 | 0 ms | 2024 KB |
#include<bits/stdc++.h> using namespace std; #define maxn 405 int n,k; int dp[maxn], mx[2]; vector<int> from[maxn]; void upd(int val) { int i; for(i=0;i<2;i++) if(mx[i]<val) swap(mx[i],val); } void dfs(int x,int last) { int i; for(i=0;i<from[x].size();i++) if(from[x][i]!=last) dfs(from[x][i],x); mx[0] = mx[1] = -1; for(i=0;i<from[x].size();i++) if(from[x][i]!=last) upd(dp[from[x][i]]); dp[x] = mx[1] + 1; // printf("dp %d = %d\n",x,dp[x]); } main() { int i,x,y; scanf("%d%d",&n,&k); for(i=0;i<n-1;i++) { scanf("%d%d",&x,&y); from[x].push_back(y); from[y].push_back(x); } dfs(1,0); if(dp[1]<=k) printf("DA"); else printf("NE"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |