# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
947513 | weakweakweak | Capital City (JOI20_capital_city) | C++17 | 499 ms | 57052 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 = 510000;
int n, k, col[N], sz[N], parr[N], vis[N] = {0}, ans = INT_MAX, ins[N] = {0}, tt = 3, tt2 = 5;
bool block[N] = {0}, finish[N] = {0};
vector <int> e[N], bel[N];
int dfs_sz (int i, int par) {
sz[i] = 1;
parr[i] = par;
for (int j : e[i]) if (j != par and !block[j]) {
dfs_sz (j, i);
sz[i] += sz[j];
}
vis[i] = tt;
return sz[i];}
int dfs_cen (int i, int par, int tot) {
for (int j : e[i]) if (j != par and !block[j] and sz[j] * 2 > tot) return dfs_cen(j, i, tot);
return i;
}
void solve (int st) {
vector <int> color_used = {st};
queue<int> q;
tt2++;
ins[st] = tt2;
# | 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... |