SPOJ Query on a tree 树链剖分 水题
摘要:You are given a tree (an acyclic undirected connected graph) withNnodes, and edges numbered 1, 2, 3...N-1.We will ask you to perfrom some instructions...
阅读全文
posted @
2015-10-15 18:47
_fukua
阅读(215)
推荐(0)
CF 191C Fools and Roads lca 或者 树链剖分
摘要:They say that Berland has exactly two problems, fools and roads. Besides, Berland hasncities, populated by the fools and connected by the roads. All B...
阅读全文
posted @
2015-10-13 13:18
_fukua
阅读(466)
推荐(0)
HDU5221 Occupation 树链剖分
摘要:题意:给出一棵树,root=1,树有点权,有一个人叫做M有3种操作:1 u v 把u到v路径上的所有点的点权都给M2 u 若u的点权在M手上,拿走3 u 把u为根的子树的所有点权都给M每一个操作过后,输出M拥有的点权想法:要维护路径,用树链剖分要维护子树,用dfs序但是这样貌似要写很多然而后来知道树...
阅读全文
posted @
2015-10-11 10:40
_fukua
阅读(214)
推荐(0)
HDU 5044 Tree 树链剖分
摘要:一棵树,初始边权和点权都为0现在有m个操作,每一个操作:ADD1 u v k: for nodes on the path from u to v, the value of these nodes increase by k.ADD2 u v k: for edges on the path fr...
阅读全文
posted @
2015-10-10 19:46
_fukua
阅读(265)
推荐(0)
HDU 2966 Aragorn's Story 树链剖分第一题 基础题
摘要:Problem DescriptionOur protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemies who w...
阅读全文
posted @
2015-05-10 20:05
_fukua
阅读(320)
推荐(0)