# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
97859 | kitsu_hi | Race (IOI11_race) | C++14 | 2225 ms | 44700 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;
vector< vector< pair<int, int> > > edges;
int size_of_subtree[200005], blocked[200005];
map <int, int> big, small;
int answer = INT_MAX;
void get_size_of_subtree(int current_node, int parent) {
size_of_subtree[current_node] = 1;
for (auto child : edges[current_node]) {
if (child.first != parent) {
get_size_of_subtree(child.first, current_node);
size_of_subtree[current_node] += size_of_subtree[child.first];
}
}
}
int get_centroid(int current_node) {
for (auto child : edges[current_node]) {
if (blocked[child.first] == 0 && size_of_subtree[child.first] > size_of_subtree[current_node] / 2) {
int total_size = size_of_subtree[current_node];
size_of_subtree[current_node] -= size_of_subtree[child.first];
size_of_subtree[child.first] = total_size;
return get_centroid(child.first);
}
}
return current_node;
}
# | 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... |