# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1042892 | Sharky | Capital City (JOI20_capital_city) | C++17 | 362 ms | 47132 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.
// https://oj.uz/submission/954992
#include <bits/stdc++.h>
using namespace std;
const int N = 200008;
int n, k, cnt = 0, bl[N] /* block */, a[N], c[N], vis[N], g[N], ans = (int) 1e18, par[N], sz[N];
vector<int> adj[N], vt[N];
void dfs_sz(int u, int p) {
bl[u] = cnt;
sz[u] = 1;
for (int v : adj[u]) {
if (v == p || c[v]) continue;
dfs_sz(v, u);
sz[u] += sz[v];
}
}
int find(int u, int p, int tot) {
int mx = -1, ret = -1;
for (int v : adj[u]) {
if (v == p || c[v]) continue;
ret = max(ret, find(v, u, tot));
mx = max(mx, sz[v]);
}
mx = max(mx, tot - sz[u]);
if (mx <= tot / 2) return u;
return ret;
# | 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... |