摘要:这尼吗桑心病狂的动态树:http://www.lydsy.com/JudgeOnline/problem.php?id=3153终于让哥以一种碉堡的姿势过了:牛B轰轰的最后两个都是我的。。。无法超越了。。。
阅读全文
摘要:HDU3966 Aragorn's StoryTime Limit: 10000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 605Accepted Submission(s): 160Problem DescriptionOur protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemi
阅读全文
摘要:SPOJ 2939. Query on a tree VProblem code: QTREE5You are given a tree (an acyclic undirected connected graph) with N nodes. The tree nodes are numbered from 1 to N. We define dist(a, b) as the number of edges on the path from node a to node b.Each node has a color, white or black. All the nodes are b
阅读全文
摘要:SPOJ Problem Set (classical)SPOJ 1487. Query on a tree IIIProblem code: PT07JYou are given a node-labeled rooted tree withnnodes.Define the query (x,k): Find the node whose label isk-th largest in the subtree of the nodex. Assume no two nodes have the same labels.InputThe first line contains one int
阅读全文
摘要:SPOJ Problem Set (classical)SPOJ 913. Query on a tree IIProblem code: QTREE2You are given a tree (an undirected acyclic connected graph) withNnodes, and edges numbered 1, 2, 3...N-1. Each edge has an integer value assigned to it, representing its length.We will ask you to perfrom some instructions o
阅读全文
摘要:SPOJ Problem Set (classical)2666. Query on a tree IVProblem code: QTREE4You are given a tree (an acyclic undirected connected graph) with N nodes, and nodes numbered 1,2,3...,N. Each edge has an integer value assigned to it(note that the value can be negative). Each node has a color, white or black.
阅读全文
摘要:SPOJ Problem Set (classical)1825. Free tour IIProblem code: FTOUR2After the success of 2nd anniversary (take a look at problemFTOURfor more details), this 3rd year, Travel Agent SPOJ goes on with another discount tour.The tour will be held onICPCisland, a miraculous one on the Pacific Ocean. We list
阅读全文
摘要:POJ1741 TreeTime Limit:1000MSMemory Limit:30000KTotal Submissions:6232Accepted:1770DescriptionGive a tree with n vertices,each edge has a length(positive integer less than 1001).Define dist(u,v)=The min distance between node u and v.Give an integer k,for every pair (u,v) of vertices is called valid
阅读全文
摘要:POJ3237 TreeTime Limit:5000MSMemory Limit:131072KTotal Submissions:2158Accepted:574DescriptionYou 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
阅读全文
摘要:Country FTime Limit:2 Seconds Memory Limit:32768 KBAs you know, in aTreethere is exactly one path between two nodes. AForestconsists of one or more Trees. Country F hasNcities, some cities are connected by roads, and these cites form a Forest withat least two trees.The king of country F is a man wit
阅读全文
摘要:POJ1639 Picnic PlanningTime Limit:5000MSMemory Limit:10000KTotal Submissions:7381Accepted:2567DescriptionThe Contortion Brothers are a famous set of circus clowns, known worldwide for their incredible ability to cram an unlimited number of themselves into even the smallest vehicle. During the off-se
阅读全文
摘要:1016: [JSOI2008]最小生成树计数Time Limit:1 SecMemory Limit:162 MBSubmit:1027Solved:384Description现在给出了一个简单无向加权图。你不满足于求出这个图的最小生成树,而希望知道这个图中有多少个不同的最小生成树。(如果两颗最小生成树中至少有一条边不同,则这两个最小生成树就是不同的)。由于不同的最小生成树可能很多,所以你只需要输出方案数对31011的模就可以了。Input第一行包含两个数,n和m,其中1<=n<=100; 1<=m<=1000; 表示该无向图的节点数和边数。每个节点用1~n的整数编
阅读全文
摘要:UESTC1565 Smart TypistTime Limit:2000 msMemory Limit:65536 kBSolved:10Tried:49DescriptionThe most mysterious organization in Chani is “Related Department”. It is related to almost everything, and has branches almost everywhere. Events always have relation with it. Whenever disasters happen, “Related
阅读全文
摘要:POJ2728 Desert KingTime Limit:3000MSMemory Limit:65536KTotal Submissions:15065Accepted:4236DescriptionDavid the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his country to bring water to every village. Villages which are
阅读全文
摘要:HDU1358 PeriodTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 675Accepted Submission(s): 321Problem DescriptionFor each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know w
阅读全文