并查集
石老师与六老板
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
小鑫的城堡
#include <bits/stdc++.h> using namespace std; int visit[123456]; int pre[123456]; int find(int x) { while(pre[x]!=x) { x=pre[x]; } return x; } void join(int a,int b) ...原创 2018-08-22 14:41:57 · 298 阅读 · 0 评论 -
电影节(并查集)
#include <bits/stdc++.h> using namespace std; int pre[1000000]; int find(int x) // 找到头 { while(x!=pre[x]) { x=pre[x]; } return x; } void join(int a,int b) // 将不同头的合并为一个...原创 2018-08-21 21:13:03 · 324 阅读 · 0 评论
分享