# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
950608 | socpite | Worst Reporter 4 (JOI21_worst_reporter4) | C++14 | 498 ms | 105416 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;
const int maxn = 2e5+5;
const int INF = 1e9+5;
vector<int> tree[maxn];
multiset<pair<int, int>, greater<>> st[maxn];
int C[maxn], H[maxn];
void dfs(int x){
for(auto v: tree[x]){
dfs(v);
if(st[v].size() > st[x].size())st[x].swap(st[v]);
}
for(auto v: tree[x]){
for(auto ele: st[v])st[x].insert(ele);
}
st[x].insert({H[x], C[x]});
auto it = st[x].upper_bound({H[x], 0});
while(it != st[x].end() && C[x]){
if(it->second > C[x]){
pair<int, int> nw = *it;
nw.second -= C[x];
st[x].erase(it);
st[x].insert(nw);
C[x] = 0;
}
else {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |