# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1005524 | ilef | Race (IOI11_race) | C++14 | 222 ms | 34388 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;
#define MAXN 200005
//const int MAX_N=2e5+14;
#define KK 1000001
int n,k;
int ans;
int mx_depth;
int cnt[KK];
bool removed[MAXN];
int subtree[MAXN];
vector<pair<int,int>>graph[MAXN];
int treesize(int node,int parent){
subtree[node]=1;
for(auto [w,child]:graph[node]){
if(child!=parent && !removed[child]){
subtree[node]+=treesize(child,node);
}
}
return subtree[node];
}
int findcentroid(int node,int parent,int treesz){
int sz=treesz/2;
for(auto[w,child]:graph[node]){
if(child!=parent && !removed[child]&& subtree[child]>(sz)){
return findcentroid(child,node,treesz);
}
}
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... |