# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
903963 | 2024-01-11T15:41:23 Z | MinaRagy06 | Burza (COCI16_burza) | C++17 | 3 ms | 1368 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 405; vector<int> adj[N]; int dp[N][N]; int dfs(int i, int rem, int par) { if (~dp[i][rem]) { return dp[i][rem]; } dp[i][rem] = 1e9; for (int k = 0; k <= rem; k++) { vector<int> v; for (auto nxt : adj[i]) { if (nxt == par) continue; v.push_back(dfs(nxt, rem - k + 1, i) + 1); } sort(v.rbegin(), v.rend()); if (k < v.size()) { dp[i][rem] = min(dp[i][rem], v[k]); } else { dp[i][rem] = 0; } } return dp[i][rem]; } int main() { ios_base::sync_with_stdio(0), cin.tie(0); memset(dp, -1, sizeof dp); int n, k; cin >> n >> k; for (int i = 1, u, v; i < n; i++) { cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } int ans = dfs(1, 1, 0); cout << (ans < k? "DA\n" : "NE\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1368 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 1112 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 1124 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |