![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LCA/DFS序
刀锋灬意志
嘤嘤嗡嗡
展开
-
POJ1330-Nearest Common Ancestors(LCA tarjan做法)
题目链接 A 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 integer from {1, 2,...,16}. Node 8 is the...原创 2019-08-19 19:49:28 · 151 阅读 · 0 评论 -
HDU2586-How far away ?(LCA 树上两点路径 tarjan和RMQ做法)
题目链接 Problem Description 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 h...原创 2019-08-19 20:57:22 · 192 阅读 · 0 评论 -
POJ3321-Apple Tree(DFS序+线段树)
题目链接 There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree. The tree...原创 2019-08-11 08:24:45 · 172 阅读 · 0 评论 -
POJ3368-Frequent values(RMQ)
题目链接 You are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ≤ n). For each quer...原创 2019-08-23 00:30:31 · 107 阅读 · 0 评论