# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
466582 | dattranxxx | Race (IOI11_race) | C++11 | 662 ms | 41732 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"
/*
* Author : shora
*/
#include <bits/stdc++.h>
#define print(_v) for (auto &_ : _v) {cerr << _ << ' ';} cerr << endl;
using namespace std;
using ll = long long;
const int oo = 1e9;
const int N = 5e5, MAXK = 1e6;
struct C {
int v, w;
C(int v, int w): v(v), w(w) {}
};
vector<C> G[N];
int vis[N], size[N], f[MAXK + 1], dep[N];
int k;
int res = oo;
void find_size(int u, int e = -1) {
size[u] = 1;
for (C& c : G[u]) if (c.v != e && !vis[c.v]) {
find_size(c.v, u);
size[u] += size[c.v];
}
}
int centroid(int s, int u, int e = -1) {
for (C& c : G[u]) if (c.v != e && !vis[c.v])
if (size[c.v] > s / 2)
return centroid(s, c.v, u);
return u;
# | 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... |