# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1159613 | duccnamm | Two Currencies (JOI23_currencies) | C++20 | 3690 ms | 50008 KiB |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,m,q,uu[100005],vv[100005],p[100005],child[100005],h[100005],par[100005],in[100005],out[100005],chainhead[100005],chainid[100005],timehld,timedfs,f[400005],l[100005],r[100005],dd,s[100005],t[100005],x[100005],y[100005],vc[100005],pp[100005];
vector<ll>a[100005];
vector<ll>que[100005];
pair<ll,ll>c[100005];
void dfsmake(ll x,ll pa)
{
child[x]=1;
for(auto it:a[x])
if(it!=pa)
{
h[it]=h[x]+1;
par[it]=x;
dfsmake(it,x);
child[x]+=child[it];
}
}
void dfshld(ll x,ll pa)
{
if(chainhead[timehld]==0)
chainhead[timehld]=x;
chainid[x]=timehld;
timedfs++;
in[x]=timedfs;
ll heavy=0;
for(auto it:a[x])
if(it!=pa)
if(heavy==0||child[it]>child[heavy])heavy=it;
# | 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... |