
树链剖分
YOONGI
这个作者很懒,什么都没留下…
展开
-
FZU - 2082 过路费 (树链剖分 + 线段树单点更新,区间求和)
过路费有n座城市,由n-1条路相连通,使得任意两座城市之间可达。每条路有过路费,要交过路费才能通过。每条路的过路费经常会更新,现问你,当前情况下,从城市a到城市b最少要花多少过路费。Input有多组样例,每组样例第一行输入两个正整数n,m(2 <= n<=50000,1<=m <= 50000),接下来n-1行,每行3个正整数a b c,(1 <= a,b...原创 2019-07-18 09:03:44 · 174 阅读 · 0 评论 -
LightOJ - 1348 Aladdin and the Return Journey (树链剖分+线段树单点更新,区间求和)
Aladdin and the Return JourneyFinally the Great Magical Lamp was in Aladdin's hand. Now he wanted to return home. But he didn't want to take any help from the Genie because he thought that it might ...原创 2019-07-18 09:38:14 · 184 阅读 · 0 评论 -
HDU-6547 Tree (树链剖分+线段树 区间开根号 区间求和)
Treewls 有三棵树,树上每个节点都有一个值aiai,现在有 2 种操作:1. 将一条链上的所有节点的值开根号向下取整;2. 求一条链上值的和;链的定义是两点之间的最短路。Input第一行两个数nn,qq分别代表树上点的数量和操作数量。第二行nn个整数,第ii个数代表第ii个点的值aiai。接下来nn−−11行, 每行两个整数uu...原创 2019-07-18 14:14:11 · 913 阅读 · 0 评论 -
luogu P3384 【模板】树链剖分 (树链剖分+线段树 区间更新,区间查询)
P3384 【模板】树链剖分题目描述如题,已知一棵包含N个结点的树(连通且无环),每个节点上包含一个数值,需要支持以下操作:操作1: 格式: 1 x y z 表示将树从x到y结点最短路径上所有节点的值都加上z操作2: 格式: 2 x y 表示求树从x到y结点最短路径上所有节点的值之和操作3: 格式: 3 x z 表示将以x为根节点的子树内所有节点值都加上z操作4: 格式: ...原创 2019-07-16 18:01:04 · 155 阅读 · 0 评论 -
HYSBZ - 1036 树的统计Count (树链剖分+线段树单点更新,区间查询)
树的统计Count一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. CHANGE u t : 把结点u的权值改为t II. QMAX u v: 询问从点u到点v的路径上的节点的最大权值 III. QSUM u v: 询问从点u到点v的路径上的节点的权值和 注意:从点u到点v的路径上的节点包括u和v本身Input ...原创 2019-07-17 11:37:32 · 106 阅读 · 0 评论 -
HDU - 3966 Aragorn's Story (树链剖分+线段树区间更新,单点查询)
Aragorn's StoryOur protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemies who want to invade his kingdom. As Aragorn knows, the ...原创 2019-07-17 14:13:16 · 246 阅读 · 0 评论 -
SPOJ - QTREE Query on a tree (树链剖分+线段树单点更新,区间查询)
Query on a treeYou 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 of the following form:C...原创 2019-07-17 16:11:57 · 155 阅读 · 0 评论 -
POJ - 3237 Tree (树链剖分+线段树单点更新,区间更新,区间最值)
TreeYou are given a tree withNnodes. The tree’s nodes are numbered 1 throughNand its edges are numbered 1 throughN− 1. Each edge is associated with a weight. Then you are to execute a series o...原创 2019-07-17 16:46:31 · 140 阅读 · 0 评论 -
POJ - 2763 Housewife Wind (树链剖分 + 线段树单点更新,区间求和)
Housewife WindAfter their royal wedding, Jiajia and Wind hid away in XX Village, to enjoy their ordinary happy life. People in XX Village lived in beautiful huts. There are some pairs of huts con...原创 2019-07-17 18:00:56 · 172 阅读 · 0 评论