RT.
为什么这么写
int ff(int x){ if(p[x]!=x){ d[x]=(d[x]^d[p[x]]); p[x]=ff(p[x]); } return p[x]; }
是错的,但是这么写
int ff(int x){ if(p[x]!=x){ int q=p[x]; p[x]=ff(p[x]); d[x]=(d[x]^d[q]); } return p[x]; }
就对了呢?