# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
856105 | wii | Race (IOI11_race) | C++17 | 353 ms | 65984 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 <iostream>
#include <vector>
using namespace std;
const int Lim = 1e6 + 5;
const int maxn = 1e6 + 5;
const int Inf = 1e9 + 7;
typedef pair<int, int> pii;
template<class T> bool minimize(T &res, const T &x) { if (x < res) { res = x; return true; } return false; }
int n, k;
vector<pii> adj[maxn];
int ans[Lim];
int sz[maxn], f[maxn];
int dfs_sz(int u, int p) {
sz[u] = 1;
for (auto [v, w]: adj[u]) if (v != p && !f[v]) {
sz[u] += dfs_sz(v, u);
}
return sz[u];
}
int find_centroid(int u, int p, int n) {
for (auto [v, w]: adj[u]) if (v != p && !f[v])
if (sz[v] * 2 > n) return find_centroid(v, u, n);
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... |