原图的不连通不止影响圆方树,还会影响求树大小。 before(部分):
dfs(1,0);
now:
for(int i=1;i<=cscnt;++i) if(!root[i]) root[i]=i, dfs(i,0);