# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
533102 | cig32 | 경주 (Race) (IOI11_race) | C++17 | 1264 ms | 46448 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "race.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<array<int, 2>>> adj;
int n, k, ans = 2e9, nodes;
vector<int> sub;
bitset<200000> is_cent;
map<int, int> mp2;
void precalc (int u, int p = -1) {
sub[u] = 1;
++nodes;
for (auto &v : adj[u]) {
if (!is_cent[v[0]] && v[0] ^ p) {
precalc(v[0], u);
sub[u] += sub[v[0]];
}
}
}
int centroid (int u, int p = -1) {
for (auto &v : adj[u]) {
if (!is_cent[v[0]] && v[0] ^ p) {
if (sub[v[0]] > nodes / 2) {
return centroid(v[0], 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... |