# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1109823 | omsincoconut | Prize (CEOI22_prize) | C++17 | 735 ms | 402548 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 pair<int, int> pii;
const int MAXN = 5e5+5;
int N, K, Q, T;
// Tree information
int P[2][MAXN], root[2];
vector<int> child[2][MAXN];
vector<int> ord[2];
int tin[2][MAXN], tout[2][MAXN], depth[2][MAXN];
int subtree_by_ord[MAXN];
pii table[22][3*MAXN]; // used for lca query
void dfs(int curtree, int u, int &cte) {
tin[curtree][u] = ++cte;
ord[curtree].push_back(u);
if (curtree == 0) table[0][cte] = make_pair(depth[curtree][u], u);
for (int v : child[curtree][u]) {
depth[curtree][v] = depth[curtree][u] + 1;
dfs(curtree, v, cte);
++cte;
if (curtree == 0) table[0][cte] = make_pair(depth[curtree][u], u);
}
# | 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... |