# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
133495 | KieranHorgan | Race (IOI11_race) | C++17 | 8 ms | 5112 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 "race.h"
#include <bits/stdc++.h>
using namespace std;
#define ing long long
int n, k;
vector<pair<int,int>> AdjList[200005];
bitset<200005> marked;
int sz[200005];
int getSz(int u, int p) {
sz[u] = 1;
for(auto v: AdjList[u]) {
if(v.first==p) continue;
if(marked[v.first]) continue;
sz[u] += getSz(v.first, u);
}
return sz[u];
}
int getCentroid(int u, int p, int compSz) {
if(sz[u]*2 < compSz)
return -1;
for(auto v: AdjList[u]) {
if(v.first==p) continue;
if(marked[v.first]) continue;
if(sz[v.first]*2 > compSz)
return getCentroid(v.first, u, compSz);
# | 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... |