# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
577121 | 2022-06-14T06:48:06 Z | keta_tsimakuridze | Burza (COCI16_burza) | C++17 | 2 ms | 1876 KB |
#include<bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define f first #define s second #define endl "\n" const int N = 505 + 5, mod = 1e9 + 7, inf = N; //! int t, dp[N][N]; int n; vector<int> V[N]; void dfs(int u, int p) { for(int i = 0; i < V[u].size(); i++) { if(V[u][i] == p) continue; dfs(V[u][i], u); } dp[u][0] = 1; for(int i = 0; i <= n; i++) { dp[u][i + 1] = 0; for(int j = 0; j < V[u].size(); j++) { if(V[u][j] == p) continue; dp[u][i + 1] += dp[V[u][j]][i]; } if(dp[u][i + 1]) dp[u][i + 1]--; } for(int i = 1; i <= n; i++) dp[u][i] = min(dp[u][i], dp[u][i - 1]); } main() { int k; cin >> n >> k; for(int i = 2 ; i <= n; i++) { int u ,v; cin >> u >> v; V[u].push_back(v);V[v].push_back(u); } dfs(1, 0); if(!dp[1][k]) { cout << "DA" ; } else cout << "NE" ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1492 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1748 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1876 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1748 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1728 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1856 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1876 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1620 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1620 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |