# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
442062 | kig9981 | Worst Reporter 4 (JOI21_worst_reporter4) | C++17 | 451 ms | 107060 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>
#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif
using namespace std;
vector<int> adj[200000];
map<int,long long> D[200000];
long long O[200000];
int P[200000], H[200000], C[200000], R[200000], cnt[200000];
void dfs(int c)
{
long long v=C[c], m;
for(auto n: adj[c]) {
dfs(n);
if(D[R[c]].size()<D[R[n]].size()) swap(R[c],R[n]);
for(auto[a,b]: D[R[n]]) D[R[c]][a]+=b;
O[c]+=O[n];
}
O[c]+=C[c];
D[R[c]][H[c]]+=C[c];
if(cnt[c]) {
D[R[c]][H[c]+1]-=C[c];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |