
并查集
文章平均质量分 78
J_Sure
唯苦修深思方能顿悟
展开
-
AOJ-AHU-OJ-489 夺宝奇兵
夺宝奇兵Time Limit: 8000 ms Case Time Limit: 8000 ms Memory Limit: 64 MBDescriptionHF市地下有一份宝藏,数不清的黄金、钻石……。令人遗憾的是,千年来未曾有人得到过这份宝藏。其中一个主要原因就是,要得到这份宝藏之前,首先需要通过一个迷宫。这个迷宫的结构非常复杂,一共有N个秘密房间。广为流传的一种说原创 2014-03-19 13:26:30 · 2130 阅读 · 0 评论 -
ZOJ-1203 Swordfish
SwordfishTime Limit: 2 Seconds Memory Limit: 65536 KB There exists a world within our worldA world beneath what we call cyberspace.A world protected by firewalls,passwords and the原创 2014-08-08 14:06:22 · 919 阅读 · 0 评论 -
POJ-2513 Colored Sticks
Colored SticksTime Limit: 5000MS Memory Limit: 128000K DescriptionYou are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color原创 2014-09-10 00:50:03 · 749 阅读 · 0 评论 -
Wikioi-1069 关押罪犯
1069 关押罪犯题目描述DescriptionS 城现有两座监狱,一共关押着N 名罪犯,编号分别为1~N。他们之间的关系自然也极不和谐。很多罪犯之间甚至积怨已久,如果客观条件具备则随时可能爆发冲突。我们用“怨气值”(一个正整数值)来表示某两名罪犯之间的仇恨程度,怨气值越大,则这两名罪犯之间的积怨越多。如果两名怨气值为c 的罪犯被关押在同一监狱,他们俩之间会发生摩擦原创 2014-08-09 11:12:28 · 1355 阅读 · 0 评论 -
POJ-1703 Find them, Catch them
Find them, Catch themTime Limit: 1000MS Memory Limit: 10000KDescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO g原创 2014-08-09 10:09:16 · 769 阅读 · 0 评论 -
ACdream-1056 Bad Horse
Bad HorseTime Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)Problem DescriptionAs the leader of the Evil League of Evil, Bad Horse has a lot of problems to deal wi原创 2014-08-09 00:27:39 · 1486 阅读 · 0 评论 -
RQNOJ-36 数石子
题目描述佳佳是个贪玩的孩子。一天,他正在跟凡凡玩“数石子”的游戏。佳佳在地上摆了N堆石子,其中第I堆石子有Ai个石头。佳佳每次都会问凡凡:“凡凡,请问从第I堆到第J堆,总共有多少个石子?”聪明的凡凡每次都能快速而准确地回答对。凡凡老是被问问题,心里有些不服,就对佳佳说:“佳佳,你还记得你问了什么问题,我回答了什么答案吗?”佳佳说当然记得。于是凡凡说:“好,我把石子拿走,再问你一些相似的问题,你原创 2014-08-06 21:51:17 · 1234 阅读 · 0 评论 -
POJ-2560 Freckles
FrecklesTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6581 Accepted: 3261DescriptionIn an episode of the Dick Van Dyke show, little Richie connects th原创 2014-05-21 14:49:32 · 1171 阅读 · 0 评论 -
HDU-OJ-1233 还是畅通工程
还是畅通工程Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连原创 2014-03-21 21:10:34 · 1344 阅读 · 0 评论 -
POJ-2492 A Bug's Life
A Bug's LifeTime Limit: 10000MS Memory Limit: 65536K DescriptionBackground Professor Hopper is researching the sexual behavior of a rare species of bugs. He a原创 2014-05-20 11:08:43 · 1273 阅读 · 0 评论 -
并查集模板[路径压缩]
1 int father[MAX]; 2 int rank[MAX]; 3 4 5 6 void Make_Set(int x)7 {8 father[x] = x; //根据实际情况指定的父节点可变化9 rank[x] = 0; //根据实际情况初始化秩也有所变化10 }11 12 13 14 int Find_Set(int原创 2014-03-19 14:52:46 · 1268 阅读 · 0 评论 -
POJ-1611 The Suspects
The SuspectsTime Limit: 1000MS Memory Limit: 20000K DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recogni原创 2014-05-18 01:29:21 · 968 阅读 · 0 评论 -
POJ-1308 Is It A Tree?
Is It A Tree?Time Limit: 1000MS Memory Limit: 10000K DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of原创 2014-05-16 21:20:37 · 1104 阅读 · 0 评论 -
POJ-1962 Corporative Network
Corporative NetworkTime Limit: 3000MS Memory Limit: 30000K ed: 1083DescriptionA very big corporation is developing its corporative network. In the beginning each o原创 2014-05-16 18:03:18 · 839 阅读 · 0 评论 -
POJ-1182 食物链
食物链Time Limit: 1000MS Memory Limit: 10000K Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法原创 2014-05-15 21:49:01 · 1107 阅读 · 0 评论 -
HDU-OJ-1232 畅通工程
畅通工程Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接原创 2014-05-15 13:38:18 · 1128 阅读 · 0 评论 -
AOJ-AHU-OJ-528 连通图
连通图Time Limit: 1000 ms Case Time Limit: 1000 ms Memory Limit: 64 MBJudge By CaseDescription在无向图G中,如果任两结点可达,则称图G是联通的; 如果G的子图G’是联通的,没有包含G’的更大子图G’’是联通的,则称G’是G的联通分图。一个无向图,要么是一个联通图,要么是由若干个联通分原创 2014-03-19 12:55:41 · 1337 阅读 · 0 评论 -
POJ-1386 Play on Words
Play on WordsTime Limit: 1000MS Memory Limit: 10000K DescriptionSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has原创 2014-09-09 21:57:33 · 983 阅读 · 0 评论