# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
377684 | LucaDantas | Fireworks (APIO16_fireworks) | C++17 | 289 ms | 68588 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 pb push_back
constexpr int maxn = 3e5+10;
vector<int> g[maxn];
priority_queue<long long> changes[maxn];
int c[maxn], start_slope[maxn], n;
long long start_y[maxn];
void combine(int a, int b) {
auto& q = changes[a];
start_y[a] += start_y[b];
start_slope[a] += start_slope[b];
for(; changes[b].size(); changes[b].pop())
q.push(changes[b].top());
}
void dfs(int u) {
if(u >= n) {
start_slope[u] = -1;
start_y[u] = c[u];
changes[u].push((long long)c[u]);
changes[u].push((long long)c[u]);
} else {
int big = g[u][0];
for(int v : g[u]) {
dfs(v);
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... |