
数据结构--树链剖分
Vmorish
这个作者很懒,什么都没留下…
展开
-
HDU - 6162 Ch’s gift(树链剖分)
HDU - 6162 Ch’s gift(树链剖分)Problem DescriptionMr. Cui is working off-campus and he misses his girl friend very much. After a whole night tossing and turning, he decides to get to his girl friend's city and of course, with well-chosen gifts. He knows neith原创 2017-08-23 10:03:35 · 350 阅读 · 0 评论 -
HDU - 3966 Aragorn's Story(树链剖分)
HDU - 3966 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 want to invade his kingdom. As Aragorn knows, the enemy has N camps out o原创 2017-08-23 15:35:16 · 251 阅读 · 0 评论 -
SPOJ - QTREE Query on a tree(树链剖分)
SPOJ - QTREE Query on a treeYou are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3...N-1.We will ask you to perfrom some instructions of the following form:CHANGE i ti : change the cost of the i-th edge t原创 2017-08-20 20:37:54 · 267 阅读 · 0 评论 -
FZU - 2082 过路费(树链剖分)
FZU - 2082 过路费(树链剖分) Problem Description有n座城市,由n-1条路相连通,使得任意两座城市之间可达。每条路有过路费,要交过路费才能通过。每条路的过路费经常会更新,现问你,当前情况下,从城市a到城市b最少要花多少过路费。 Input有多组样例,每组样例第一行输入两个正整数n,m(2 <= n<=50000,1<=m <= 50000),接下来n-1行,每行3个正整数a b c,(1 <= a,b <= n , a != b , 1 <= c <= 100000原创 2017-08-28 10:19:55 · 301 阅读 · 0 评论 -
POJ - 2763 Housewife Wind(树链剖分)
POJ - 2763 Housewife Wind(树链剖分)DescriptionAfter 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 connected by bidirectional roads.原创 2017-08-24 10:09:37 · 235 阅读 · 0 评论 -
POJ - 3237 Tree(树链剖分)
POJ - 3237 Tree(树链剖分)DescriptionYou are given a tree with N nodes. The tree’s nodes are numbered 1 through N and its edges are numbered 1 through N − 1. Each edge is associated with a weight. Then you are to execute a series of instructions on the tree.原创 2017-08-28 19:27:11 · 334 阅读 · 0 评论 -
HYSBZ - 1036 树的统计Count(树链剖分)
HYSBZ - 1036 树的统计Count(树链剖分)Description 一棵树上有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 输入的第一行为一个整数n,表示节点的个数。接下原创 2017-08-29 09:19:50 · 312 阅读 · 0 评论 -
HYSBZ - 2243 [SDOI2011]染色(树链剖分)
HYSBZ - 2243 [SDOI2011]染色(树链剖分)Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成颜色c;2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“112221”由3段组成:“11”、“222”和“1”。请你写一个程序依次完成这m个操作。Input第一行包含2个整数n和m,分别表示节点数和操作数;第二行包含n个正整数表示n个节点的初始颜色下面 行每行包含两个整数x和y,表示x和y原创 2017-09-03 09:11:31 · 292 阅读 · 0 评论