
lca
Lyang0.0
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
F - Nearest Common Ancestors(lca + 树上倍增)
题目链接:https://cn.vjudge.net/problem/POJ-1330A rooted tree is a well-known data structure in computer science and engineering. An example is shown below:In the figure, each node is labeled with an ...原创 2019-08-21 08:38:08 · 197 阅读 · 0 评论 -
P3379 最近公共祖先(LCA 模板)
题目描述如题,给定一棵有根多叉树,请求出指定两个点直接最近的公共祖先。输入格式第一行包含三个正整数N、M、S,分别表示树的结点个数、询问的个数和树根结点的序号。接下来N-1行每行包含两个正整数x、y,表示x结点和y结点之间有一条直接连接的边(数据保证可以构成树)。接下来M行每行包含两个正整数a、b,表示询问a结点和b结点的最近公共祖先。输出格式输出包含M行,每行包含一个...原创 2019-08-16 14:28:30 · 157 阅读 · 0 评论 -
E - How far away ?(lca)
There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want to go from house A to house B"? Usually it hard to...原创 2019-08-16 16:03:52 · 194 阅读 · 0 评论