# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
998148 | alexdumitru | Race (IOI11_race) | C++14 | 112 ms | 27476 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 <iostream>
#include <vector>
using namespace std;
const int NMAX = 1e5;
const int KMAX = 1e6;
vector<pair<int, int>> g[NMAX];
int w[NMAX];
bool used[NMAX];
int minDepth[KMAX + 1];
int Ans;
int get_w(int node, int dad) {
w[node] = 1;
for (auto it : g[node]) {
if (it.first == dad || used[it.first]) continue;
get_w(it.first, node);
w[node] += w[it.first];
}
return w[node];
}
int get_centroid(int node, int dad, int totalW) {
for (auto it : g[node]) {
if (it.first == dad || used[it.first]) continue;
if (w[it.first] > totalW / 2)
return get_centroid(it.first, node, totalW);
# | 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... |