随笔分类 -  树链剖分

POJ 3237 Tree (树链剖分)
摘要:TreeTime Limit:5000MSMemory Limit:131072KTotal Submissions:2825Accepted:769DescriptionYou 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 of instructions on the tree 阅读全文

posted @ 2013-08-17 07:30 kuangbin 阅读(4902) 评论(0) 推荐(2)

1036: [ZJOI2008]树的统计Count (树链剖分)
摘要:1036: [ZJOI2008]树的统计CountTime Limit:10 SecMemory Limit:162 MBSubmit:3401Solved:1418[Submit][Status]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输入的第一行为一个 阅读全文

posted @ 2013-08-15 10:25 kuangbin 阅读(3097) 评论(0) 推荐(1)

HDU 3966 Aragorn's Story (树链剖分+树状数组)
摘要:Aragorn's StoryTime Limit: 10000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1321Accepted Submission(s): 344Problem DescriptionOur protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemies who 阅读全文

posted @ 2013-08-14 23:55 kuangbin 阅读(2174) 评论(0) 推荐(0)

SPOJ 375. Query on a tree (树链剖分)
摘要:题目链接:http://www.spoj.com/problems/QTREE/375. Query on a treeProblem code: QTREEYou 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:CHANGE i ti: change the cost of the i-th edge to 阅读全文

posted @ 2013-08-12 19:45 kuangbin 阅读(3616) 评论(2) 推荐(0)

树链剖分学习
摘要:最近一段时间决定先好好搞一下数据结构了,首先搞了下树链剖分;专题训练:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28982#overview树链剖分并不是一个复杂的算法或者数据结构,只是能把一棵树拆成链来处理而已,换一种说法,树链剖分只是xxx数据结构/算法在树上的推广,或者说,树链剖分只是把树hash到了几段连续的区间上。学习链接:入门:http://blog.sina.com.cn/s/blog_7a1746820100wp67.html (看了这个讲解,再把题目A掉就有点理解了)https://quartergeek.co 阅读全文

posted @ 2013-08-12 19:43 kuangbin 阅读(13255) 评论(0) 推荐(2)

导航

JAVASCRIPT: