# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29003 | h0ngjun7 | 트리 (KOI16_tree) | C++14 | 476 ms | 37728 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 <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
#define pb push_back
#define sz size
#define all(X) (X).begin(), (X).end ()
typedef pair < int, int > pii;
const int MAXN = 200005;
int N, M, Lev[MAXN], Par[MAXN], SZ[MAXN], bn, dfsn[MAXN], dn, Tail[MAXN];
int Chain[4 * MAXN], Time[4 * MAXN];
vector <int> E[MAXN];
void DFS(int x, int par) {
Par[x] = par;
SZ[x] = 1;
for (auto &it : E[x]) {
if (it != par) {
Lev[it] = Lev[x] + 1;
DFS(it, x);
SZ[x] += SZ[it];
}
}
}
void hld(int x, int par, int Color) {
dfsn[x] = ++dn;
Chain[bn + dn] = Color;
Tail[Color] = dn;
int idx = -1;
for (auto &it : E[x]) {
if (it != par && (idx == -1 || SZ[it] > SZ[x]))
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |