随笔 - 418  文章 - 0  评论 - 18  阅读 - 132万

随笔分类 -  并查集

POJ 1962-Corporative Network (并查集)
摘要:题目有2种操作, 一种是查询,一种是设置。设置为将u的父亲设置为v,然后他们之间的距离为|u-v|%1000查询为该点到根点的距离用并查集做,做的时候注意维护即可,注意取余操作。代码: 1 #include 2 #include 3 #include 4 using namespace std; 5... 阅读全文
posted @ 2015-04-21 15:34 细雨微光 阅读(260) 评论(0) 推荐(0) 编辑
poj1703 Find them, Catch them(并查集的应用)
摘要:Find them, Catch themTime Limit:1000MSMemory Limit:10000KTotal Submissions:32225Accepted:9947DescriptionThe police office in Tadu City decides to say ... 阅读全文
posted @ 2014-10-22 22:07 细雨微光 阅读(326) 评论(0) 推荐(0) 编辑
poj 1182 食物链 并查集的又一个用法
摘要:食物链Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 41584Accepted: 12090Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N... 阅读全文
posted @ 2014-04-23 13:16 细雨微光 阅读(259) 评论(0) 推荐(0) 编辑
hdoj 1272 小希的迷宫 又一个并查集的简单应用
摘要:小希的迷宫Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23551Accepted Submission(s): 7234Problem Desc... 阅读全文
posted @ 2014-04-22 11:08 细雨微光 阅读(302) 评论(0) 推荐(0) 编辑
poj 1611 The Suspects 并查集变形题目
摘要:The SuspectsTime Limit: 1000MSMemory Limit: 20000KTotal Submissions: 20596Accepted: 9998DescriptionSevere acute respiratory syndrome (SARS), an atypic... 阅读全文
posted @ 2014-04-21 21:30 细雨微光 阅读(308) 评论(0) 推荐(0) 编辑
poj 2524 Ubiquitous Religions 一简单并查集
摘要:Ubiquitous ReligionsTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 22389Accepted: 11031DescriptionThere are so many different religions in t... 阅读全文
posted @ 2014-04-21 17:50 细雨微光 阅读(377) 评论(0) 推荐(0) 编辑
一个找亲戚游戏,引发了一场算法的学习——并查集
摘要:题目描述: 若某个家族人员过于庞大,要判断两个是否是亲戚,确实还很不容易,给出某个亲戚关系图,求任意给出的两个人是否具有亲戚关系。 规定:x和y是亲戚,y和z是亲戚,那么x和z也是亲戚。 如果x,y是亲戚,那么x的亲戚都是y的亲戚,y的亲戚也都是x的亲戚。输入: 第一行:三个整数n,m,p,(n 2... 阅读全文
posted @ 2014-04-19 09:20 细雨微光 阅读(1103) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示