并查集
文章平均质量分 66
御用铲屎官
没有简述。
展开
-
畅通工程 -- 并查集
题目:某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应M条道路,每行给出一对正原创 2017-11-29 18:46:23 · 210 阅读 · 0 评论 -
Play on Words -- 并查集
题目:Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very im原创 2017-11-29 21:27:45 · 191 阅读 · 0 评论 -
The Suspects -- 并查集
题目:Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to原创 2017-12-01 11:25:10 · 198 阅读 · 0 评论 -
Ubiquitous Religions -- 并查集
题目:There are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university be原创 2017-12-01 12:48:12 · 179 阅读 · 0 评论 -
How Many Tables -- 并查集
题目:Today is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other,原创 2017-12-01 13:12:32 · 199 阅读 · 0 评论 -
How Many Answers Are Wrong -- 并查集
题目:TT and FF are … friends. Uh… very very good friends -__-b FF is a bad boy, he is always wooing TT to play the following game with him. This is a very humdrum game. To begin with, TT should write d原创 2017-12-01 17:04:59 · 214 阅读 · 0 评论 -
Supermarket -- 贪心 + 并查集
题目:A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment the原创 2017-12-01 18:55:16 · 268 阅读 · 0 评论 -
食物链 -- 并查集
题目:动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是”1 X Y”,表示X和Y是同类。 第二种说法是”2 X Y”,表示X吃Y。 此人对N个动物,用上述两种说法,一句接一句原创 2017-12-01 13:48:04 · 221 阅读 · 0 评论