随笔分类 - ACM/ICPC-POJ
ACM/ICPC,POJ
摘要:并查集:(union-find sets)一种简单的用途广泛的集合. 并查集是若干个不相交集合,能够实现较快的合并和判断元素所在集合的操作,应用很多,如其求无向图的连通分量个数等。最完美的应用当属:实现Kruskar算法求最小生成树。并查集的精髓(即它的三种操作,结合实现代码模板进行理解):1、Make_Set(x) 把每一个元素初始化为一个集合初始化后每一个元素的父亲节点是它本身,每一个元素的祖先节点也是它本身(也可以根据情况而变)。2、Find_Set(x) 查找一个元素所在的集合查找一个元素所在的集合,其精髓是找到这个元素所在集合的祖先!这个才是并查集判断和合并的最终依据。判断两个元素.
阅读全文
摘要:Military RecruitTime Limit:1000MSMemory Limit:65536KTotal Submissions:1124Accepted:542DescriptionBackgroundTom is a military recruit for an elite army unit. As the last part of his final exams, he will be put into unknown terrain and has to find his way ...
阅读全文
摘要:Currency ExchangeTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 14080Accepted: 4842DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. Ther.
阅读全文
摘要:Invitation CardsTime Limit: 8000MSMemory Limit: 262144KTotal Submissions: 14928Accepted: 4831DescriptionIn the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. .
阅读全文
摘要:SubwayTime Limit:1000MSMemory Limit:65536KTotal Submissions:4511Accepted:1473DescriptionYou have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and tak...
阅读全文
摘要:Fiber NetworkTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2495Accepted: 1146DescriptionSeveral startup companies have decided to build a better Internet, called the "FiberNet". They have already installed many nodes that act as routers all around the world. Unfortunately, they
阅读全文
摘要:Military RecruitTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1110Accepted: 536DescriptionBackground Tom is a military recruit for an elite army unit. As the last part of his final exams, he will be put into unknown terrain and has to find his way to a designated exit point, carrying all.
阅读全文
摘要:Til the Cows Come HomeTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 21530Accepted: 7161DescriptionBessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants
阅读全文
摘要:Heavy CargoTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2412Accepted: 1321DescriptionBig Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the Godzilla V12, is so big that the amount of cargo you can transport with it is never limited by the .
阅读全文
摘要:ArbitrageTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 10997Accepted: 4622DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 British p.
阅读全文
摘要:Six Degrees of Cowvin BaconTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1891Accepted: 886DescriptionThe cows have been making movies lately, so they are ready to play a variant of the famous game "Six Degrees of Kevin Bacon". The game works like this: each cow is considered to
阅读全文
摘要:Median Weight BeadTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 2356Accepted: 1182DescriptionThere are N beads which of the same shape and size, but with different weights. N is an odd number and the beads are labeled as 1, 2, ..., N. Your task is to find the bead whose weight is median .
阅读全文
摘要:Wooden SticksTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 14809Accepted: 6081DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs some time, called.
阅读全文
摘要:Heavy TransportationTime Limit: 3000MSMemory Limit: 30000KTotal Submissions: 15595Accepted: 4057DescriptionBackground Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place .
阅读全文
摘要:TramTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 7102Accepted: 2570DescriptionTram network in Zagreb consists of a number of intersections and rails connecting some of them. In every intersection there is a switch pointing to the one of the rails going out of the intersection. When the .
阅读全文
摘要:Shipping RoutesTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 309Accepted: 171DescriptionThe Slow Boat to China Shipping company needs a program to help them quickly quote costs to prospective customers. The cost of a shipment depends on the size of the shipment and on how many shipping l.
阅读全文
摘要:MPI MaelstromTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 3378Accepted: 1990DescriptionBIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee's research a
阅读全文
摘要:The Postal Worker Rings OnceTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 515Accepted: 331DescriptionGraph algorithms form a very important part of computer science and have a lineage that goes back at least to Euler and the famous Seven Bridges of Konigsberg problem. Many optimization ..
阅读全文
摘要:Alien SecurityTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 2359Accepted: 894DescriptionYou are in charge of security at a top-secret government research facility. Recently your government has captured a live extra-terrestrial (ET) life form, and is hosting an open day for fellow researc.
阅读全文
摘要:昂贵的聘礼Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 26888Accepted: 7496Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其他的东
阅读全文

浙公网安备 33010602011771号