并查集
Below_Crusder
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu1102 克鲁斯卡尔+并查集
#include #include #include #include "algorithm" using namespace std; int n,pos; int op[10000]; int ed[10000]; int dis[10000]; int tmp[10000]; int father[110]; int cmp(int a,int b){return原创 2015-09-08 19:04:48 · 438 阅读 · 0 评论 -
poj2395(最小生成树最大边)
水题 最小生成树求最大边 表示并查集+kruskal真的好用 Source Code #include #include "stdio.h" #include "stdlib.h" #include "string.h" #include "math.h" #include using namespace std; #define inf 99999999 int a[1原创 2015-07-29 16:23:50 · 617 阅读 · 0 评论 -
POJ2985 (线段树+并查集)
题目链接:http://poj.org/problem?id=2985 题意:输入n(猫的数量)和m(操作的总数),求分组以及合并操作后,第K大的组的规模大小 解题思路:并查集+线段树 Source Code /*以分组的规模作为划分线段的标准 有n只猫则可能存在的分组中规模最大的为n,规模最小的为1 tree[k]表示规模为tree[k].left---tree[原创 2015-07-12 16:30:04 · 856 阅读 · 0 评论
分享