摘要:
#include <stdio.h>#include <string.h>#define N 1001int ufs[N];int rank[N];bool rec[N];int getFather(int n){if(ufs[n]!=n) ufs[n]=getFather(ufs[n]);return ufs[n];}int merge(int a, int b){int ta=getFather(a) ;int tb=getFather(b) ;if(ta != tb)ufs[ta] = tb;return 0; }void count(int n){int i;i 阅读全文