
并查集
文章平均质量分 85
追逐星辰的光
脚踏实地,虚心前行
展开
-
HDU - 3038 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 shou原创 2017-12-23 23:30:37 · 190 阅读 · 0 评论 -
POJ 1308 Is It A Tree?
A 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 edges between nodes satisfying the following properties. The原创 2018-01-23 17:53:27 · 250 阅读 · 0 评论 -
HDU 1272 小希的迷宫
上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的原创 2018-01-23 17:48:55 · 245 阅读 · 0 评论 -
HDU - 4496 - D-City
Luxer is a really bad guy. He destroys everything he met. One day Luxer went to D-city. D-city has N D-points and M D-lines. Each D-line connects exactly two D-points. Luxer will destroy all the D-l原创 2018-01-23 19:55:12 · 296 阅读 · 0 评论 -
POJ - 2524 Ubiquitous Religions
北理CS学院2015级的学长学姐们终于搬到村里了,他们住进了新的宿舍,你想知道学校给CS学院一共安排了多少宿舍,但矜持的学长学姐们是不会直接告诉你他们宿舍号的,你唯一机会是当看到两位学姐相伴而行或者两位学长相依为Gay的时候,就可以断定他们住在同一间宿舍。已知CS学院2015级共有n(n Input有多组数据。对于每组数据:第一行:两个整数n和m。 以下m行:每行包含两个整数i原创 2018-01-23 10:51:29 · 255 阅读 · 0 评论 -
HDU 3038 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 shou原创 2018-01-23 09:52:49 · 236 阅读 · 0 评论 -
POJ 1988 Cube Stacking
Farmer John and Betsy are playing a game with N (1 <= N <= 30,000)identical cubes labeled 1 through N. They start with N stacks, each containing a single cube. Farmer John asks Betsy to perform P (1<=转载 2018-01-05 11:36:42 · 172 阅读 · 0 评论 -
POJ 2492 A Bug's Life
Background Professor 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 gen原创 2018-01-04 23:22:27 · 315 阅读 · 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, a原创 2018-01-21 20:15:26 · 233 阅读 · 0 评论 -
POJ - 2421 Constructing Roads
There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only if t原创 2017-12-28 21:23:42 · 248 阅读 · 0 评论 -
POJ 1611 The Suspects
严重急性呼吸系统综合症( SARS), 一种原因不明的非典型性肺炎,从2003年3月中旬开始被认为是全球威胁。为了减少传播给别人的机会, 最好的策略是隔离可能的患者。在Not-Spreading-Your-Sickness大学( NSYSU), 有许多学生团体。同一组的学生经常彼此相通,一个学生可以同时加入几个小组。为了防止非典的传播,NSYSU收集了所有学生团体的成员名单。他们的标准操作程序原创 2018-01-05 20:16:40 · 204 阅读 · 0 评论 -
Wireless Network
An 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 computers in the n原创 2018-01-21 19:42:53 · 205 阅读 · 0 评论 -
CodeForces 776D The Door Problem
Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors ar原创 2017-12-30 18:10:51 · 382 阅读 · 0 评论 -
POJ - 2236 Wireless Network
An 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 computers in the n原创 2017-12-24 11:10:47 · 186 阅读 · 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个动物,用上述两种说法,原创 2018-01-09 16:04:39 · 205 阅读 · 0 评论