# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
846648 | biximo | Two Currencies (JOI23_currencies) | C++17 | 1119 ms | 48728 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;
using p = pair<int, int>;
const int MAX_N = 100105;
int n, m, q, id=1, len=131072, ids[MAX_N], sz[MAX_N], depth[MAX_N] = {0};
long long tree[262144];
vector<int> paths[MAX_N];
vector<p> pathsA;
int table[18][MAX_N];
int LCA(int a, int b) {
if(depth[a] != depth[b]) {
if(depth[a] < depth[b]) swap(a, b);
int diff = depth[a] - depth[b];
for(int i = 17; i >= 0; i --) {
if(diff & (1 << i)) {
a = table[i][a];
}
}
}
assert(depth[a] == depth[b]);
for(int i = 17; i >= 0; i --) {
if(table[i][a] != table[i][b]) {
a = table[i][a];
b = table[i][b];
}
}
if(a != b) a = table[0][a];
return a;
}
void calcTable() {
# | 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... |