
并查集
MashiroSky
这个作者很懒,什么都没留下…
展开
-
【poj1962】 Corporative Network
http://poj.org/problem?id=1962 (题目链接)时隔多年又一次写带权并查集。题意:n个节点,若干次询问,I x y表示从x连一条边到y,权值为|x-y|%1000;E x表示询问x到x所指向的终点的距离。Solution 很裸的带权并查集。代码:// poj1962 #include<algorithm> #include<iostream> #include<cst原创 2016-09-12 20:17:20 · 396 阅读 · 0 评论 -
【poj1182】 食物链
http://poj.org/problem?id=1182 (题目链接)题意:中文题Solution 带权并查集。 神犇博客,秒懂 %3运用的很巧妙。代码:// poj1182 #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> #include<cstdio> #include<c转载 2016-09-12 20:22:56 · 343 阅读 · 0 评论 -
【bzoj1202】 HNOI2005—狡猾的商人
http://www.lydsy.com/JudgeOnline/problem.php?id=1202 (题目链接)题意:给出m段区间和,判断是否存在某段区间与之前读入的区间相矛盾。Solution 裸带权并查集。 代码:// bzoj1202 #include<algorithm> #include<iostream> #include<cstdlib> #include<cst原创 2016-09-12 22:48:26 · 415 阅读 · 0 评论