# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
968681 | RandomUser | Putovanje (COCI20_putovanje) | C++17 | 185 ms | 27356 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 ll = long long;
const int LOG = 20;
const int maxn = 2e5 + 5;
ll ans = 0;
vector<array<int, 3> > graph[maxn];
int up[maxn][LOG], depth[maxn], diff[maxn], dp[maxn];
void dfs1(int u, int p) {
for(int i=1; i<LOG; i++) up[u][i] = up[up[u][i-1]][i-1];
for(auto &[v, c1, c2] : graph[u]) {
if(v == p) continue;
depth[v] = depth[u] + 1;
up[v][0] = u;
dfs1(v, u);
}
}
int jmp(int x, int d) {
for(int j=LOG-1; j>=0; j--)
if(d & (1 << j)) x = up[x][j];
return x;
}
int get_lca(int a, int b) {
if(depth[a] < depth[b]) swap(a, b);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |