# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
542804 | someone | Worst Reporter 4 (JOI21_worst_reporter4) | C++14 | 454 ms | 88020 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>
#define int long long
using namespace std;
const int N = 2e5 + 42, INF = 1e18 + 42;
int n, h[N], cost[N], par[N];
bool vu[N], root[N], act[N];
vector<int> adj[N], path, id[N];
multiset<pair<int, int>> DFS(int i, int pre) {
vu[i] = true;
multiset<pair<int, int>> ans;
for(int j : adj[i])
if(j != pre) {
multiset<pair<int, int>> fils = DFS(j, i);
if(ans.size() < fils.size())
swap(ans, fils);
for(auto p : fils)
ans.insert(p);
}
for(int j : id[i]) {
ans.insert({0, cost[j]});
ans.insert({h[j]+1, cost[j]});
}
for(int j : id[i]) {
int suppr = cost[j];
while(suppr) {
auto it = ans.lower_bound({h[j]+1, 0});
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |