并查集水题
有n个人,m队朋友,朋友的朋友,也是朋友,A与B是朋友,B与C是朋友,那么A与C也是朋友,即A,B,C在同一个并查集里,合并即可;
最后会有几个“朋友圈子”,求最大的朋友圈的人数。
#include
#include
#include
#include
using namespace std;
int r[30005];
int x[30010];
int init(int n...
分类:
其他好文 时间:
2014-11-14 22:48:36
阅读次数:
165
Collect the answers,interested friends from research。1,Interface and Abstract difference?2,Generic type' s 'where' keyword?3,What's the kind of wcf bi...
分类:
Web程序 时间:
2014-11-13 10:33:02
阅读次数:
240
1 #include 2 using namespace std; 3 long long m,cnt1,cnt2,x,y; 4 long long gcd(long long a,long long b) 5 { 6 if (b==0) return a; 7 return gc...
分类:
其他好文 时间:
2014-11-09 12:27:11
阅读次数:
161
Mistwald
Time Limit: 2 Seconds Memory Limit: 65536 KB
In chapter 4 of the game Trails in the Sky SC, Estelle Bright and her friends are crossing Mistwald to meet their final enemy, Lucciola...
分类:
其他好文 时间:
2014-11-07 20:56:09
阅读次数:
225
Language:
Default
Farm Tour
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 11916
Accepted: 4454
Description
When FJ's friends visit him on the farm, h...
分类:
其他好文 时间:
2014-11-05 19:46:12
阅读次数:
122
Seam CarvingDescriptionFish likes to take photo with his friends. Several days ago, he found that some pictures of him were damaged. The trouble is th...
分类:
其他好文 时间:
2014-11-05 19:26:39
阅读次数:
255
Layout
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 7468
Accepted: 3581
Description
Like everyone else, cows like to stand close to their friends when...
分类:
其他好文 时间:
2014-11-05 09:20:39
阅读次数:
156