30分RE,求助dalao们qwqqq

P3367 【模板】并查集

数组小点,才1w
by LCuter @ 2018-08-28 18:37:50


@[常暗踏阴](/space/show?uid=83547) 开100w也不会爆吧
by Reywmp @ 2018-08-28 18:40:11


@[ALIENWARE](/space/show?uid=57273) 嗯,但是我还是觉得尽量别太浪费
by LCuter @ 2018-08-28 18:41:21


@[常暗踏阴](/space/show?uid=83547) 10000开过,依然炸qwq
by Lisbeth_Rivaille @ 2018-08-28 18:41:59


我的 ``` #include<bits/stdc++.h> using namespace std; int n,m,prt[10010]; int getfather(int k){ if(prt[k]==k){ return k; } return prt[k]=getfather(prt[k]); } int main(){ scanf("%d %d",&n,&m); for(int i=1;i<=n;++i){ prt[i]=i; } for(int i=1;i<=m;++i){ int a,b,c; scanf("%d %d %d",&a,&b,&c); if(a==1){ prt[getfather(b)]=getfather(c); } else{ if(getfather(b)==getfather(c)){ printf("Y\n"); } else{ printf("N\n"); } } } return 0; } ```
by LCuter @ 2018-08-28 18:42:32


@[待捕捉蒟蒻QvvQ](/space/show?uid=123634) 您真的是wx?
by LCuter @ 2018-08-28 18:42:54


@[常暗踏阴](/space/show?uid=83547) 是啊,我有空用大号给你私信证实一下qwq%%%
by Lisbeth_Rivaille @ 2018-08-28 18:43:34


@[常暗踏阴](/space/show?uid=83547) https://www.luogu.org/recordnew/show/10267689 ,看去吧,我真的布吉岛肿么肥四qwq
by Lisbeth_Rivaille @ 2018-08-28 18:46:19


@[待捕捉蒟蒻QvvQ](/space/show?uid=123634) 修改不用路径压缩?
by Lolierl @ 2018-08-28 18:48:27


@[Lolierl](/space/show?uid=22930) 压了啊qwq
by Lisbeth_Rivaille @ 2018-08-28 18:49:22


| 下一页