for (int i = 20; i >= 0; i--) { if (fa[x][i] != fa[y][i]) { ans = std::max(ans, std::max(f_max[x][i], f_max[y][i])); x = fa[x][i]; y = fa[x][i]; // 犯这种错误是人啊,倍增求lca都能写错 } }
https://www.luogu.com.cn/record/190978864