# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
218430 | GioChkhaidze | Capital City (JOI20_capital_city) | C++14 | 876 ms | 35056 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>
#define pb push_back
using namespace std;
const int N=2e5+5;
int n,k,ans=1e9;
bool f[N],fix[N],lvl[N];
int c[N],P[N],Cf[N];
vector < int > v[N],s[N],h;
int Dfs(int x,int p,int sz,int ¢er) {
int tot=1;
Cf[c[x]]++;
h.pb(x);
for (int i=0; i<v[x].size(); i++) {
int to=v[x][i];
if (!lvl[to] && to!=p)
tot+=Dfs(to,x,sz,center);
}
if (center==-1 && (2*tot>=sz || !p)) center=x;
return tot;
}
void Go(int x,int p) {
P[x]=p;
for (int i=0; i<v[x].size(); i++) {
int to=v[x][i];
if (!lvl[to] && to!=p) Go(to,x);
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |