KyuShell__xH2 @ 2024-03-12 17:42:39
节点编号是0~n-1,并查集初始化的过程一定要改成0~n-1!
for(int i = 0; i <= n - 1; i++) fa[i] = i; for(int i = 0; i <= n - 1; i++) { if(!vis[i] && !ban[i]) { dfs(i, i); ans++; } }