图论——LCA
pxlsdz
冲就完了!
展开
-
树的最近公共祖先
LCA(Lowest Common Ancestors),即最近公共祖先,是指在有根树中,找出某两个结点u和v最近的公共祖先。 推荐书籍:算法进阶指南 倍增算法(在线) //n结点的树,输出任意两个结点间的最小距离 #include<iostream> #include<cstdio> #include<cstring> #include<algo...原创 2019-04-07 00:49:53 · 548 阅读 · 0 评论 -
ACM-ICPC 2018 徐州赛区网络预赛 J. Maze Designer 最大生成树+LCA
After the long vacation, the maze designer master has to do his job. A tour company gives him a map which is a rectangle. The map consists ofN \times MN×Mlittle squares. That is to say, the height o...原创 2019-08-30 15:30:42 · 225 阅读 · 1 评论