![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
G_rass
这个作者很懒,什么都没留下…
展开
-
uvalive 3027
Description A very big corporation is developing its corporative network. In the beginning each of the N enterprises of the corporation, numerated from 1 to N, organized its own computing a原创 2015-08-13 22:21:35 · 358 阅读 · 0 评论 -
hdu 1213
思路:并查集的基本应用 #include #include #include using namespace std; int f[100008]; int find(int x) { return x==f[x]?x:f[x]=find(f[x]); } int init(int n) { for(int i=0;i<=n;i++) f[i]=i;原创 2015-09-15 20:04:45 · 321 阅读 · 0 评论 -
uvalive 3644 X-Plosives
思路:简单的并查集应用,两个点有相同的祖先是组成环,会引起爆炸,不能放,num++。 #include #include #include using namespace std; int f[100008]; int find(int x) { return x==f[x]?x:f[x]=find(f[x]); } int init() { for(int i=0;i<1原创 2015-09-15 19:42:51 · 366 阅读 · 0 评论