# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
968681 | RandomUser | Putovanje (COCI20_putovanje) | C++17 | 185 ms | 27356 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |