Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 41913 Accepted: 12879 Description The police office in Tadu City decides to say ends to the ...
分类:
其他好文 时间:
2016-09-13 00:10:12
阅读次数:
146
明天旅游去爬山逛庙玩,今天练一天然后早早睡觉啦~ poj1703 Find them, Catch them (带权并查集) 1 #include<cstdio> 2 const int N=1e5+1; 3 int f[N]; 4 int r[N];//表示与父节点的关系,0同类,1不同类 5 i ...
分类:
其他好文 时间:
2016-08-13 22:39:07
阅读次数:
422
poj1703 题意:有两个帮派,给定一些操作,A a b判断a与b是否在同一帮派,D a b将a与b加入不同帮派 分析:非常好的并查集题目,用两倍的并查集分别来表示两个帮派,当进行D操作时,将a与b+n,a+n与b分别加同一帮派,A操作时进行判断,same(a,b)表示a与b在同一帮派,same( ...
分类:
其他好文 时间:
2016-05-15 02:26:54
阅读次数:
190
《ACM/ICPC算法训练教程》读书笔记-这一次补上并查集的部分。将对并查集的思想进行详细阐述,并附上本人AC掉POJ1703的Code。
分类:
其他好文 时间:
2015-11-04 12:47:45
阅读次数:
287
给定集合{1,2,...,n}的一个置换,指定每个位置上在其左方且比其小的数的个数,求该置换。这题我目前还只会O(n^2)的做法。以后再用更高效的算法解决。http://poj.org/problem?id=2182 1 #include 2 #include 3 #include 4 usi...
分类:
其他好文 时间:
2015-09-25 16:27:38
阅读次数:
131
并查集。这题错了不少次才过的。分析见代码。http://poj.org/problem?id=1703 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxn = 1e5 + 10; 6 const ch...
分类:
其他好文 时间:
2015-09-24 22:42:47
阅读次数:
260
题目链接:http://poj.org/problem?id=1703可以认为n个人和m句话;每句话包含A a b;D a b;刚开始关系不确定;A a b 就是问ab 是否同类;Da b就是告诉我们ab不同类;#include #include #include #include #include...
分类:
其他好文 时间:
2015-09-07 21:11:02
阅读次数:
137
Description
The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to...
分类:
其他好文 时间:
2015-08-18 19:29:43
阅读次数:
148
DescriptionThe police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Ga...
分类:
其他好文 时间:
2015-04-16 01:07:09
阅读次数:
223
Find them, Catch them
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 20000/10000K (Java/Other)
Total Submission(s) : 2 Accepted Submission(s) : 1
Problem Description
The police office...
分类:
其他好文 时间:
2014-12-09 15:40:53
阅读次数:
171