# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
411938 | Ruxandra985 | Village (BOI20_village) | C++14 | 121 ms | 18948 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 DIMN 100010
using namespace std;
int n , mini , fth , centroid;
long long maxi;
int which[DIMN] , wm[DIMN] , sub[DIMN] , f[DIMN];
vector <int> v[DIMN] , w[DIMN];
priority_queue <pair <int , int> > h;
void dfs (int nod , int tt){
int i , vecin , ok = 1;
for (i = 0 ; i < v[nod].size() ; i++){
vecin = v[nod][i];
if (vecin != tt){
dfs (vecin , nod);
sub[nod] += sub[vecin] + 1;
if (sub[vecin] + 1 > n / 2)
ok = 0;
}
}
if (n - sub[nod] - 1 > n / 2)
ok = 0;
if (ok && !centroid){
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... |