# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
906266 | tvladm2009 | Worst Reporter 4 (JOI21_worst_reporter4) | C++17 | 2025 ms | 39764 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.
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define pb push_back
#define int long long
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
const int N = 2e5 + 7;
int n;
int par[N], h[N], c[N];
vector<int> g[N];
long long dp[N], sum[N];
long long get(int node, int lim) {
long long sol = c[node];
for (int v : g[node]) sol += get(v, lim);
if (h[node] >= lim) sol = min(sol, dp[node]);
return sol;
}
void dfs(int u) {
sum[u] = c[u];
dp[u] = 0;
for (int v : g[u]) {
dfs(v);
sum[u] += sum[v];
dp[u] += get(v, h[u]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |