LCA
文章平均质量分 59
Cymbals
Public void effect()
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU - 2586 How far away ?(最近公共祖先)
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...原创 2018-09-26 19:16:48 · 435 阅读 · 0 评论 -
两道可持久化字典树的模板题(HDU - 4757和HDU - 6191 )
两道题都是树上异或最大值的问题,这一类问题都是可持久化01字典树的模板题,不过需要一些树论知识来处理一下。HDU - 4757:求树上两点路径间的异或最大值。显而易见,两点路径就是个lca。对每一个节点,以其父亲为last版本,新建可持久化字典树即可。最后用(sz[next[now][!d]] + sz[next[now2][!d]]) - (2 * sz[next[now3][!d]]...原创 2018-10-04 22:21:35 · 432 阅读 · 1 评论 -
SPOJ - COT Count on a tree(树上第k大模板题)
You are given a tree with N nodes. The tree nodes are numbered from 1 to N. Each node has an integer weight.We will ask you to perform the following operation:u v k : ask for the kth minimum weight ...原创 2018-10-10 15:52:56 · 332 阅读 · 0 评论
分享