# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1094633 | _8_8_ | Tourism (JOI23_tourism) | C++17 | 5071 ms | 1048576 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;
typedef long long ll;
const int N = 1e5 + 12, MOD = (int)1e9 + 7;
const int L = 19;
vector<int> g[N];
int n, m, q, c[N], tin[N], tout[N], timer, s[N], head[N], ver[N];
int up[N][19], dep[N];
void bb(int v, int pr = -1) {
s[v] = 1;
for(int i = 0; i < (int)g[v].size(); i++) {
int to = g[v][i];
if(to == pr) continue;
bb(to, v);
s[v] += s[to];
if(s[to] > s[g[v][0]] || g[v][0] == pr) {
swap(g[v][i], g[v][0]);
}
}
}
void hld(int v, int pr = -1) {
tin[v] = ++timer;
ver[timer] = v;
for(int to:g[v]) {
if(to == pr) continue;
if(to == g[v][0]) {
head[to] = head[v];
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |