# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
609706 | penguinhacker | Capital City (JOI20_capital_city) | C++17 | 962 ms | 159568 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;
#define ll long long
#define ar array
const int mxN=2e5, MX=1e6;
int n, k, c[mxN], n2;
int d[mxN], s[mxN], p[mxN], hd[mxN], tin[mxN], tin2[mxN];
int who[mxN], cnt[mxN];
vector<int> oc[mxN], adj1[mxN], adj2[MX], adj3[MX], st, nodes;
bool vis[MX], out[MX];
void dfs1(int u=0) {
s[u]=1;
for (int& v : adj1[u]) {
adj1[v].erase(find(adj1[v].begin(), adj1[v].end(), u));
d[v]=d[u]+1, p[v]=u;
dfs1(v);
s[u]+=s[v];
if (s[v]>s[adj1[u][0]])
swap(v, adj1[u][0]);
}
}
void dfs2(int u=0, int h=0) {
static int timer=0;
hd[u]=h, tin[u]=timer++, tin2[tin[u]]=u;
if (adj1[u].empty())
return;
Compilation message (stderr)
# | 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... |