# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
787488 | eltu0815 | Flights (JOI22_flights) | C++17 | 366 ms | 540672 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 "Ali.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int n;
int dep[10005], parent[10005][14];
vector<int> tree[10005];
}
int LCA(int u, int v) {
if(dep[u] < dep[v]) swap(u, v);
int diff = dep[u] - dep[v], j = 0;
while(diff) {
if(diff & 1) u = parent[u][j];
diff >>= 1; ++j;
}
if(u == v) return u;
for(int i = 13; i >= 0; --i) {
if(parent[u][i] != parent[v][i]) {
u = parent[u][i];
v = parent[v][i];
}
}
return parent[u][0];
}
void dfs(int node, int par) {
dep[node] = dep[par] + 1; parent[node][0] = par;
for(auto v : tree[node]) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |