# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
920445 | Ludissey | Cat Exercise (JOI23_ho_t4) | C++14 | 804 ms | 148176 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 int long long
vector<vector<int>> adj;
int n;
const int LOG=63;
vector<int> p;
vector<int> depth;
vector<bool> proc;
vector<bool> visited;
vector<int> parent;
vector<vector<pair<int,int>>> child;
vector<vector<int>> ancestors;
vector<int> sz;
int lca(int a, int b){
if(depth[b]>depth[a]) swap(a,b);
int k=depth[a]-depth[b];
for (int j = LOG-1; j >= 0; j--)
{
if(k&((long long)1<<j)) a=ancestors[a][j];
}
if(a==b) return a;
for (int j = LOG-1; j >= 0; j--)
{
if(ancestors[a][j]!=ancestors[b][j]) {
a=ancestors[a][j];
b=ancestors[b][j];
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |