# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
139933 | nvmdava | Fireworks (APIO16_fireworks) | C++17 | 457 ms | 93604 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 ll long long
int p[300005];
int b[300005];
ll a[300005];
priority_queue<pair<long long, int> > pq[300005];
vector<int> ch[300005];
void dfs(int v){
int big = 0;
for(int& x : ch[v]){
dfs(x);
if(pq[big].size() < pq[x].size()) big = x;
}
if(big == 0){
pq[v].push({0, -1});
pq[v].push({a[v], 1});
pq[v].push({a[v], 1});
return;
}
swap(pq[big], pq[v]);
int g = ch[v].size();
for(auto& x : ch[v]){
if(x == big) continue;
while(!pq[x].empty()){
pq[v].push(pq[x].top());
pq[x].pop();
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... |