# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1039902 | juicy | Worst Reporter 4 (JOI21_worst_reporter4) | C++17 | 249 ms | 524288 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;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
const int N = 2e5 + 5;
int n;
int a[N], c[N], dp[N];
vector<int> g[N];
map<int, long long> mp[N];
void dfs(int u) {
for (int v : g[u]) {
dfs(v);
if (mp[u].size() < mp[v].size()) {
mp[u].swap(mp[v]);
}
for (auto [x, y] : mp[v]) {
mp[u][x] += y;
}
}
mp[u][a[u]] += c[u];
for (auto it = mp[u].upper_bound(a[u]); it != mp[u].end(); it = mp[u].erase(it)) {
auto &delta = (*it).second;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |