# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
827527 | Kubogi | Parkovi (COCI22_parkovi) | C++17 | 1245 ms | 40468 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// 11 ptt when ?
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fileio(name) if (fopen(name".inp", "r")) freopen(name".inp", "r", stdin), freopen(name".out", "w", stdout)
const int maxn = 2e5+4, inf = 1e18;
int n, k;
vector<pair<int, int> > adj[maxn];
int f[maxn], g[maxn];
bool chosen[maxn];
void dfs(int u, int p, int val, int wp) {
for (auto e: adj[u]) {
int v = e.first, w = e.second;
if (v != p) {
dfs(v, u, val, w);
f[u] = max(f[u], w + f[v]);
g[u] = min(g[u], w + g[v]);
}
}
if (f[u] + g[u] > val) {
if (f[u] + wp > val || (u == 1 && f[u] >= 0)) {
chosen[u] = true;
f[u] = -inf, g[u] = 0;
}
} else {
f[u] = -inf;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |