摘要: $O(log(n))$求第k个父亲节点 参考:树上倍增的写法和应用(详细讲解,新手秒懂) // Created by CAD #include <bits/stdc++.h> using namespace std; const int maxn=5e5+5; vector<int> g[maxn] 阅读全文
posted @ 2020-08-05 09:33 caoanda 阅读(137) 评论(0) 推荐(0) 编辑
摘要: ###倍增法求最近公共祖先 参考:题解 P3379 【模板】最近公共祖先(LCA) 参考:树上倍增的写法和应用(详细讲解,新手秒懂) // Created by CAD #include <bits/stdc++.h> using namespace std; const int maxn=5e5+ 阅读全文
posted @ 2020-08-05 09:31 caoanda 阅读(116) 评论(0) 推荐(0) 编辑