# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
711483 | Foxyy | Mergers (JOI19_mergers) | C++17 | 959 ms | 196524 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 Foxyy cin.tie(0); cout.sync_with_stdio(0);
#define ll long long
namespace HLD {
int n;
vector<vector<int>>& adj = *(new vector<vector<int>>());
vector<int> chainRootOfNode{};
vector<int> heavyChild{};
vector<int> parent{};
vector<int> height{};
vector<int> depth{};
void scanHeavy(int u, int p) {
if (p != -1) {
depth[u] = depth[p] + 1;
}
parent[u] = p;
int currentHeavyChild = -1;
for (int v : adj[u]) if (v != p) {
scanHeavy(v, u);
if (currentHeavyChild == -1 or height[v] + 1 > height[currentHeavyChild]) {
currentHeavyChild = v;
}
}
heavyChild[u] = currentHeavyChild;
height[u] = height[heavyChild[u]] + 1;
}
# | 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... |