Skip to content
Snippets Groups Projects
Commit b00c5bf6 authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Fix LCA

parent a7543847
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,8 @@ void dfs(int v, int p = -1, int c = 0) {
for (int i = 1; i < MAXLOG; i++)
if (par[v][i - 1] + 1) {
par[v][i] = par[par[v][i - 1]][i - 1];
//*** cost[v][i] += cost[v][i - 1] + cost[par[v][i - 1]][i - 1];
//* cost[v][i] += cost[v][i - 1] + cost[par[v][i - 1]][i - 1];
//** cost[v][i] = max(cost[v][i], max(cost[par[v][i-1]][i-1], cost[v][i-1]));
}
for (auto u : graph[v])
......@@ -42,7 +43,7 @@ void preprocess(int v) {
dfs(v);
}
// Return LCA between p and q
// Return LCA (or sum or max) between p and q
int query(int p, int q) {
//*** int ans = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment