
并查集
文章平均质量分 68
lenga5241
这个作者很懒,什么都没留下…
展开
-
Zoj 3563 Connections in Galaxy War 逆向并查集
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3563原创 2014-04-17 08:35:25 · 613 阅读 · 0 评论 -
51Nod 1163 最高的奖励 并查集&贪心
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1163t原创 2014-10-01 20:16:41 · 1203 阅读 · 0 评论 -
codeforces 468B Two Sets 并查集变形
题目链接:题目大意:给你N个数,再给原创 2014-09-23 17:31:41 · 902 阅读 · 0 评论 -
poj 3228 Gold Transportation 并查集
题目链接:http://poj.org/problem?id=3228题目大意:原创 2014-07-15 13:51:20 · 640 阅读 · 0 评论 -
Hdu 1598 find the most comfortable road 并查集&枚举
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1598题目大意:求从一点到另外一点的原创 2014-07-13 15:14:51 · 449 阅读 · 0 评论 -
Hdu 1198 Farm Irrigation 基础并查集
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1198题目大意:给你已知结构的方框原创 2014-07-13 15:26:57 · 435 阅读 · 0 评论 -
hdu3172 Virtual Friends 并查集 map映射
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3172题目大意:给你原创 2014-04-09 21:37:17 · 651 阅读 · 0 评论 -
hdu 1558 Segment set 线段相交+并查集
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1558题目大意:给你原创 2014-04-09 20:38:29 · 559 阅读 · 0 评论 -
Hand in Hand 并查集 同构图
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3926原创 2014-04-09 15:14:04 · 629 阅读 · 0 评论 -
poj3938 Portal 并查集
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3938题目大意:给你n原创 2014-04-09 08:11:56 · 516 阅读 · 0 评论 -
How Many Tables&&小希的迷宫 并查集
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1213原创 2014-04-08 16:56:06 · 450 阅读 · 0 评论 -
Supermarket 并查集或贪心
题目链接:http://poj.org/problem?id=1456题目原创 2014-04-04 16:03:00 · 535 阅读 · 0 评论 -
Find them, Catch them 并查集
题目链接:http://poj.org/problem?id=1703题目大意:在一个城市里有两个犯罪团伙,现给你两个人,请你判断他们是否在一个犯罪团伙。。。这道题也是种类并查集的基础应用吧,代码如下:#includestruct node{ int f;//父节点 int r;//关系} s[100005];int find(int x){ int原创 2014-04-03 21:11:35 · 531 阅读 · 0 评论 -
A Bug's Life 种类并查集
题目信息:http://poj.org/problem?id=2492就是种类并查集的一种,如果理解食物链的思想,这道题应该不是问题,都是用向量的思想理解,代码如下:#includestruct node{ int f; int r;} s[20010];int find(int x){ int temp; if(x==s[x].f) return原创 2014-04-03 20:56:48 · 762 阅读 · 0 评论 -
UVA 11987 Almost Union-Find 并查集节点删除
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3138题目大意:原创 2014-04-18 16:46:00 · 591 阅读 · 0 评论 -
Hdu 2818 Building Block 加权并查集
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2818题目大意:有N个原创 2014-04-18 09:19:25 · 566 阅读 · 0 评论 -
畅通工程 并查集
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=608 畅通工程最裸的并查集应用:只需要查找集合的个数,然后集合个数-1就是要修的路的条数,代码如下: #includeint f[1005],rank[1005];int find(int x){ if(x==f[x]) return x; return原创 2014-04-02 21:07:44 · 561 阅读 · 0 评论 -
树的判定 并查集
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=129 树的判定关于树,即只有一个根节点,也即根节点的入度为0,其它点入度为1;代码如下:#include#includeconst int N=1e4+5;int father[N],rank[N],visit[N],in[N];void init(){ for原创 2014-04-02 21:28:49 · 555 阅读 · 0 评论 -
食物链 种类并查集
struct存储题目链接:http://poj.org/problem?id=1182解题思路:这道题是并查集题目中的经典。。。而且比普通并查集提高了一个档次,下面在基础并查集的前提上讲解并查集的真正用法。基础回顾:find()函数找根结点的两种写法如下:第一种递归:[cpp] view plaincopyprint?int转载 2014-04-03 20:42:48 · 614 阅读 · 0 评论