# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
899679 | LucaIlie | Worst Reporter 4 (JOI21_worst_reporter4) | C++17 | 492 ms | 100828 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 MAX_N = 2e5;
int n;
bool vis[MAX_N + 1];
int parent[MAX_N + 1], height[MAX_N + 1], cost[MAX_N + 1], sc[MAX_N + 1];
vector <int> edges[MAX_N + 1], children[MAX_N + 1];
map <int, long long> inc[MAX_N + 1];
void computeDP( int u ) {
sc[u] = cost[u];
for ( int v: children[u] ) {
computeDP( v );
sc[u] += sc[v];
}
int maxSize = 0, h = -1;
for ( int v: children[u] ) {
if ( inc[v].size() > maxSize ) {
maxSize = inc[v].size();
h = v;
}
}
inc[u][-1] = 0;
if ( h == -1 ) {
inc[u][0] -= cost[u];
inc[u][height[u] + 1] += cost[u];
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... |