# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1156006 | Pekiban | Capital City (JOI20_capital_city) | C++20 | 461 ms | 37892 KiB |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N = 2e5 + 5;
vector<int> g[N], h[N];
int sz[N], c[N], p[N], f[N];
bool vis[N], visC[N], bad[N];
void dfssz(int s, int e = -1) {
sz[s] = 1;
for (auto u : g[s]) {
if (u == e || vis[u]) continue;
dfssz(u, s);
sz[s] += sz[u];
}
}
int centroid(int s, int n, int e = -1) {
for (auto u : g[s]) {
if (u == e || vis[u]) continue;
if (sz[u] > n/2) return centroid(u, n, s);
}
return s;
}
void dfsroot(int s, int e = -1) {
for (auto u : g[s]) {
if (u == e || vis[u]) continue;
p[u] = s;
dfsroot(u, s);
# | 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... |