# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
529930 | 79brue | Railway (BOI17_railway) | C++14 | 158 ms | 27184 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;
int n, m, k;
vector<pair<int, int> > link[100002];
int parId[100002];
int in[100002], inCnt;
int DP[100002], par[100002];
int LCADB[100002][22], depth[100002];
vector<int> ans;
void dfs(int x, int p = -1){
in[x] = ++inCnt;
for(auto y: link[x]){
if(y.first == p) continue;
par[y.first] = x;
LCADB[y.first][0] = x;
depth[y.first] = depth[x] + 1;
parId[y.first] = y.second;
dfs(y.first, x);
}
}
int getLCA(int x, int y){
if(depth[y] > depth[x]) swap(x, y);
for(int i=0; i<20; i++) if((depth[x] - depth[y]) & (1<<i)) x = LCADB[x][i];
if(x==y) return x;
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... |