# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
840847 | qthang2k11 | Magic Tree (CEOI19_magictree) | C++17 | 94 ms | 30412 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.
// https://codeforces.com/blog/entry/68748?#comment-530918
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 5;
int n, k, max_d, d[N], w[N];
vector<int> adj[N];
map<int, ll> dp[N];
int sz[N], id[N];
void insert(int x, int d, int w) {
dp[x][d] += w;
auto it = dp[x].upper_bound(d);
while (it != dp[x].end() && it->second <= w)
w -= it->second, it = dp[x].erase(it);
if (it != dp[x].end()) it->second -= w;
}
void dfs(int x) {
id[x] = x;
sz[x] = d[x] > 0;
int mx = -1, spec = x;
for (int y: adj[x]) {
dfs(y);
if (sz[y] > mx)
spec = y, mx = sz[y];
# | 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... |
# | 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... |