摘要:Throw nailsTime Limit: 5000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 262Accepted Submission(s): 94Problem DescriptionThe annual school bicycle contest started. ZL is a student in this school. He is so boring because he can't ride a bike!! So he decided t
阅读全文
摘要:TroubleTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1870Accepted Submission(s): 588Problem DescriptionHassan is in trouble. His mathematics teacher has given him a very difficult problem called 5-sum. Please help him.The 5-sum problem is define
阅读全文
摘要:The Famous ClockTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 217Accepted Submission(s): 179Problem DescriptionMr. B, Mr. G and Mr. M are now in Warsaw, Poland, for the 2012’s ACM-ICPC World Finals Contest. They’ve decided to take a 5 hours train
阅读全文
摘要:A Famous GridTime Limit: 10000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 365Accepted Submission(s): 148Problem DescriptionMr. B has recently discovered the grid named "spiral grid".Construct the grid like the following figure. (The grid is actually
阅读全文
摘要:A Famous CityTime Limit: 10000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 372Accepted Submission(s): 162Problem DescriptionAfter Mr. B arrived in Warsaw, he was shocked by the skyscrapers and took several photos. But now when he looks at these photos, he finds
阅读全文
摘要:The Famous ICPC Team AgainTime Limit: 30000/15000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 203Accepted Submission(s): 91Problem DescriptionWhen Mr. B, Mr. G and Mr. M were preparing for the 2012 ACM-ICPC World Final Contest, Mr. B had collected a large set of con
阅读全文
摘要:A Famous Music ComposerTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 216Accepted Submission(s): 129Problem DescriptionMr. B is a famous music composer. One of his most famous work was his set of preludes. These 24 pieces span the 24 musical keys
阅读全文
摘要:Drainage DitchesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4149Accepted Submission(s): 1929Problem DescriptionEvery time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is
阅读全文
摘要:畅通工程再续Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6695Accepted Submission(s): 2000Problem Description相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,
阅读全文
摘要:畅通工程Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9311Accepted Submission(s): 3617Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。Input测试输入包含若干测试用例。每个测试用例的第1
阅读全文
摘要:最短路径问题Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4103Accepted Submission(s): 1220Problem Description给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是
阅读全文
摘要:畅通工程续Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11676Accepted Submission(s): 3921Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多
阅读全文
摘要:A Walk Through the ForestTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3047Accepted Submission(s): 1114Problem DescriptionJimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a
阅读全文
摘要:How Many TablesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5718Accepted Submission(s): 2690Problem DescriptionToday is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he need
阅读全文
摘要:Is It A Tree?Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6600Accepted Submission(s): 1545Problem DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed
阅读全文
摘要:Dragon Ballshttp://acm.hdu.edu.cn/showproblem.php?pid=3635题意:给出n个龙珠,开始的时候第i个龙珠在第i个城市,然后下面有q个操作 T a b:把第a个龙珠所在城市的所有龙珠移动到第b个龙珠所在的城市 Q a :询问第a个龙珠所在的城市,这个城市有多少颗龙珠,这颗龙珠被移动多少次思路:第a个龙珠所在的城市与这个城市有多少颗龙珠比较简单用并查集找到结点a的根结点与根结点的秩就行了,而龙珠a被移动的次数比较麻烦,我们讲合并两个集合的过程看做第一个集合的根结点移动次数+1,那对于任意一个结点就可以用cnt[a]+cnt[find(a)]表示a
阅读全文
摘要:Play on WordsTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2589Accepted Submission(s): 830Problem DescriptionSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because
阅读全文
摘要:畅通工程Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15836Accepted Submission(s): 8136Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给
阅读全文
摘要:小希的迷宫Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12513Accepted Submission(s): 3717题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1272Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果
阅读全文