
并查集
GAUSS_CLB
acm模板分享:https://github.com/gauss-clb/acm-algorithm-template
展开
-
畅通工程
畅通工程Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( <原创 2014-03-25 10:54:32 · 522 阅读 · 0 评论 -
Cube Stacking
Cube StackingTime Limit: 2000MS Memory Limit: 30000KTotal Submissions: 17959 Accepted: 6208Case Time Limit: 1000MSDescriptionFarmer John and Betsy are playing原创 2014-05-20 01:07:26 · 648 阅读 · 0 评论 -
Parity game
Parity gameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6004 Accepted: 2315DescriptionNow and then you play the following game with your friend. Your f原创 2014-05-21 04:03:32 · 655 阅读 · 0 评论 -
Supermarket
SupermarketTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 8614 Accepted: 3701DescriptionA supermarket has a set Prod of products on sale. It earns a prof原创 2014-05-24 02:15:37 · 560 阅读 · 0 评论 -
Find them, Catch them
Find them, Catch themTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 29554 Accepted: 9086DescriptionThe police office in Tadu City decides to say ends to原创 2014-05-23 13:39:36 · 542 阅读 · 0 评论 -
ZOJ Problem Set - 2412
Farm IrrigationTime Limit: 2 Seconds Memory Limit: 65536 KBBenny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipe原创 2014-08-27 10:40:05 · 606 阅读 · 0 评论 -
食物链
食物链Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 42262 Accepted: 12315Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A原创 2014-05-18 03:18:50 · 556 阅读 · 0 评论 -
p1403 种类并查集
描述 S 城现有两座监狱,一共关押着N 名罪犯,编号分别为1~N。他们之间的关系自然也极不和谐。很多罪犯之间甚至积怨已久,如果客观条件具备则随时可能爆发冲突。我们用“怨气值”(一个正整数值)来表示某两名罪犯之间的仇恨程度,怨气值越大,则这两名罪犯之间的积怨越多。如果两名怨气值为c 的罪犯被关押在同一监狱,他们俩之间会发生摩擦,并造成影响力为c 的冲突事件。 每年年末,警察局会原创 2015-03-16 00:25:26 · 592 阅读 · 0 评论