![](https://img-blog.csdnimg.cn/20190918140213434.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
并查集
文章平均质量分 81
算法 并查集
Water_Coder
正在学算法
展开
-
小希的迷宫 HDU - 1272 + Is It A Tree? POJ - 1308 (并查集)
小希的迷宫上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的设计图是否符合她的设计思路。比如下面的例子,前两个是符合条件的,但是最后一个却有两种方法从5到达8。原创 2021-03-18 19:58:39 · 197 阅读 · 0 评论 -
A Bug‘s Life POJ - 2492(并查集)
A Bug’s LifeBackgroundProfessor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with bugs of the opposite gender. In his experiment, individual bugs and t原创 2021-03-17 20:18:18 · 148 阅读 · 0 评论 -
食物链 POJ - 1182(并查集)
食物链动物王国中有三类动物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个动物,用上述两种说法,一句接一句地说出K句话,这K句话有的是真的,有的是假的。当一句话满足下列三条之一时,这句话就是假话,否则就是真话。1) 当前的话与前面原创 2021-03-17 20:09:02 · 100 阅读 · 0 评论 -
HDU-3038-How Many Answers Are Wrong(并查集)
How Many Answers Are WrongTT and FF are … friends. Uh… very very good friends -________-bFF is a bad boy, he is always wooing TT to play the following game with him. This is a very humdrum game. To ...原创 2020-01-10 16:55:10 · 234 阅读 · 0 评论 -
HDU-1213-How Many Tables(并查集/(板子))
How Many TablesToday 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 kn...原创 2020-01-09 21:31:36 · 351 阅读 · 0 评论 -
POJ-1611-The Suspects(并查集)
The SuspectsSevere 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 str...原创 2020-01-09 11:03:49 · 330 阅读 · 0 评论 -
POJ-2236-Wireless Network(并查集)
Wireless NetworkAn earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all c...原创 2020-01-07 20:10:34 · 243 阅读 · 0 评论