help! 蒟蒻蜜汁MLE 大佬求调

P2619 [国家集训队] Tree I

@[FUUUUUUUUUCCCCCKKKKK](/user/391527) 用户名危
by lighthouse @ 2021-12-26 08:31:09


@[FUUUUUUUUUCCCCCKKKKK](/user/391527) 这边建议使用压缩路径呢 `return f[x] = find(x);`改成`f[x] = find(f[x])`
by lighthouse @ 2021-12-26 08:34:55


实测AC
by lighthouse @ 2021-12-26 08:35:17


@[lighthouse](/user/218180) ![](https://cdn.luogu.com.cn/upload/image_hosting/bzdkymza.png) emm...
by 违规用户名S42u&!u& @ 2021-12-26 09:30:22


@[FUUUUUUUUUCCCCCKKKKK](/user/391527) ![](https://cdn.luogu.com.cn/upload/image_hosting/6l2zc4sj.png) ?
by lighthouse @ 2021-12-26 09:54:59


@[FUUUUUUUUUCCCCCKKKKK](/user/391527) 把`return f[x] = find(x);` 改成`return f[x] = find(f[x]);`
by lighthouse @ 2021-12-26 09:55:35


find函数里面
by lighthouse @ 2021-12-26 09:56:32


@[FUUUUUUUUUCCCCCKKKKK](/user/391527) 而且这不是上个星期刚讲过的吗(
by lighthouse @ 2021-12-26 09:57:06


上次下午我没来
by 违规用户名S42u&!u& @ 2021-12-26 10:03:39


|