# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
540279 | surgutti | Capital City (JOI20_capital_city) | C++17 | 1168 ms | 49820 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>
using namespace std;
const int N = 200'007;
int n, k;
vector<int> adj[N];
int c[N];
vector<int> col[N];
int vis[N], sz[N], par[N], done[N], tim;
vector<int> cur[N];
void prepare(int u, int f) {
sz[u] = 1;
cur[c[u]].push_back(u);
for (int v : adj[u]) if (!vis[v] && v != f) {
prepare(v, u);
sz[u] += sz[v];
par[v] = u;
}
}
int find_centroid(int u, int f, int all) {
for (int v : adj[u]) if (!vis[v] && v != f) {
if (sz[v] >= all / 2) {
return find_centroid(v, u, all);
}
}
# | 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... |