# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
894630 | amirhoseinfar1385 | Capital City (JOI20_capital_city) | C++17 | 617 ms | 36576 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 maxn=200000+10;
vector<int>adj[maxn],allc[maxn];
int n,k,val[maxn],sz[maxn],part[maxn],visc[maxn],vis[maxn],now[maxn],rishe,res;
void calsz(int u,int par=0){
now[u]=rishe;
part[u]=par;
visc[val[u]]=0;
sz[u]=1;
for(auto x:adj[u]){
if(vis[x]==0&&x!=par){
calsz(x,u);
sz[u]+=sz[x];
}
}
}
int findcen(int u,int su,int par=0){
for(auto x:adj[u]){
if(vis[x]==0&&x!=par&&sz[x]*2>su){
return findcen(x,su,u);
}
}
return u;
}
void solve(int u){
if(now[u]==-rishe){
return ;
}
if(now[u]!=rishe){
# | 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... |