# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133812 | 2019-07-21T13:08:20 Z | forelax | Burza (COCI16_burza) | C++14 | 3 ms | 376 KB |
#include<bits/stdc++.h> using namespace std; vector<vector<int> > ng; vector<int> dp; vector<bool> md; int n,k; void build(int ind,int par,int dep){ if(dep==k){ dp[ind]=1e6; md[ind]=true; return; } int mx=0; int sm=0; for(int i = 0 ; i < ng[ind].size() ; i ++){ int ne=ng[ind][i]; if(ne==par)continue; build(ne,ind,dep+1); if(md[ne]){ md[ind]=true; sm+=dp[ind]; mx=max(dp[ind],mx); } } dp[ind]=sm-mx+min(mx,1); } int main(){ cin>>n>>k; ng.resize(n); for(int i = 0,a,b ; i < n-1 ; i ++){ cin>>a>>b;a--;b--; ng[a].push_back(b); ng[b].push_back(a); } dp.resize(n); md.resize(n); build(0,-1,0); // for(int i = 0 ; i < n ; i ++) // cout<<i<<" "<<dp[i]<<endl;; // cout<<"NE"; // return 0; if(dp[0]<k){ cout<<"DA"; }else{ cout<<"NE"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |