# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
311690 | BeanZ | Railway (BOI17_railway) | C++14 | 279 ms | 54796 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.
// I_Love_LPL
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int N = 1e5 + 5;
const int lg = 17;
vector<pair<ll, ll>> node[N];
vector<ll> fuckoff[N];
vector<ll> ans;
ll dep[N], dp[N][18], up[N];
set<ll> st[N];
ll k;
ll LCA(ll u, ll v){
if (dep[u] > dep[v]) swap(u, v);
ll dis = dep[v] - dep[u];
for (int i = lg; i >= 0; i--){
if (dis & (1 << i)){
v = dp[v][i];
}
}
if (u == v) return u;
for (int i = lg; i >= 0; i--){
if (dp[u][i] != dp[v][i]){
v = dp[v][i];
u = dp[u][i];
}
}
return dp[u][0];
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... |