# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
408883 | ScarletS | Village (BOI20_village) | C++17 | 119 ms | 16632 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 N = 1e5+1;
int n, ct, sub[N], eC[N], ans[2][N], cost;
long long tot;
bitset<N> done;
vector<int> e[N], v;
void dfs(int c, int p)
{
int mx=0;
sub[c]=1;
for (int i : e[c])
if (i!=p)
{
dfs(i,c);
sub[c]+=sub[i];
tot+=min(sub[i],n-sub[i])*2;
mx=max(mx,sub[i]);
}
if (max(mx,n-sub[c])<=n/2)
ct=c;
}
void dfsAns(int c, int p)
{
v.push_back(c);
for (int i : e[c])
if (i!=p)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |