# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
874565 | onlk97 | Two Currencies (JOI23_currencies) | C++14 | 2984 ms | 67588 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;
int n,m,q;
vector <int> g[100010];
pair <int,int> edg[100010],op[100010];
int dep[100010],pa[100010][17],siz[100010],hson[100010];
void dfs1(int cur,int prv){
if (prv) dep[cur]=dep[prv]+1;
pa[cur][0]=prv;
siz[cur]=1;
int mxz=0;
for (int i:g[cur]){
if (i==prv) continue;
dfs1(i,cur);
siz[cur]+=siz[i];
if (siz[i]>mxz){
mxz=siz[i];
hson[cur]=i;
}
}
}
int curidx,id[100010],tp[100010];
void dfs2(int cur,int topn){
id[cur]=++curidx;
tp[cur]=topn;
if (!hson[cur]) return;
dfs2(hson[cur],topn);
for (int i:g[cur]){
if (i!=pa[cur][0]&&i!=hson[cur]) dfs2(i,i);
}
# | 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... |