求助,3个点TLE

P3367 【模板】并查集

你没有路径压缩,find函数应该这样写 ``` int find(int x){ if(f[x]!=x)f[x]=find(s[x]); return f[x]; } ```
by forlight @ 2018-08-17 15:41:27


@[forlight](/space/show?uid=97238) ``` int find(int x){ if(f[x]!=x)f[x]=find(f[x]); return f[x]; } ```
by forlight @ 2018-08-17 15:42:14


@[forlight](/space/show?uid=97238) 已经AC了,谢谢
by 肖泽源 @ 2018-08-17 15:47:15


@[forlight](/space/show?uid=97238) 感谢 , 好久没写并查集都忘掉了,谢谢提醒
by Carbon @ 2018-09-18 23:22:56


|