并查集
文章平均质量分 68
JamesLee0001
无
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj1703
#include #include #include using namespace std; int T,n,m,par[200005],rk[200005]; void inital(int &n) { for(int i=0;i<=2*n;i++) { par[i]=i; rk[i]=0; } } int f(int x) {原创 2015-02-07 15:03:13 · 278 阅读 · 0 评论 -
poj3977
#include #include #include #include using namespace std; pair cor[1005]; int n,d,par[1005],rk[1005]; bool isconnect(int i1,int i2,int d) { return d*d>=(cor[i1].first-cor[i2].first)*(cor[i1].firs原创 2015-02-07 14:27:51 · 541 阅读 · 0 评论 -
uva 12118 Inspector's Dilemma
In a country, there are a number of cities. Each pair of city is connected by a highway, bi-directional ofcourse. A road-inspector’s task is to travel through the highways (in either direction) and to原创 2015-08-10 20:47:33 · 499 阅读 · 0 评论 -
hihocoder 1689 推断大小关系 并查集+dfs
#1689 : 推断大小关系 时间限制:20000ms 单点时限:2000ms 内存限制:256MB 描述 有N个整数A1, A2, ... AN,现在我们知道M条关于这N个整数的信息。每条信息是: Ai < Aj 或者 Ai = Aj 小Hi希望你能从第一条信息开始依次逐条处理这些信息。一旦能推断出A1和AN的大小关系就立即停止。 输出在处理第几条时第一次推断出A1...原创 2018-10-17 17:21:27 · 244 阅读 · 0 评论
分享