# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
574154 | AQT | Magic Tree (CEOI19_magictree) | C++14 | 106 ms | 31588 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;
int N, M, K;
vector<int> graph[100005];
int day[100005];
long long val[100005];
map<int, long long> dfs(int n) {
map<int, long long> ret;
for(int e : graph[n]) {
auto m = dfs(e);
if(ret.size() < m.size()) {
swap(ret, m);
}
for(auto p : m) {
ret[p.first] += p.second;
}
}
if(val[n]) {
ret[day[n]] += val[n];
long long pre = 0;
while(1) {
auto ptr = ret.upper_bound(day[n]);
if(ptr != ret.end()) {
pre += ptr->second;
if(pre > val[n]) {
ptr->second = pre - val[n];
break;
# | 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... |