# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
901600 | aminjonshermatov | 경주 (Race) (IOI11_race) | C++17 | 555 ms | 47952 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>
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 42
#include "race.h"
#endif
int best_path(int n, int k, int H[][2], int L[]) {
std::vector<std::vector<std::pair<int, int>>> g(n);
for (int i = 0; i + 1 < n; ++i) {
g[H[i][0]].emplace_back(H[i][1], L[i]);
g[H[i][1]].emplace_back(H[i][0], L[i]);
}
std::vector<int> size(n);
std::vector<bool> died(n, false);
auto dfs_sz = [&](auto& f, int v, int p) -> int {
size[v] = 1;
for (auto [u, _] : g[v]) {
if (u != p && !died[u]) {
size[v] += f(f, u, v);
}
}
return size[v];
};
auto centroid = [&](auto& f, int v, int p, int desired) -> int {
for (auto [u, _] : g[v]) {
if (u != p && !died[u] && size[u] >= desired) {
# | 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... |