View Code
1 procedure union(x,y:longint);
2 begin
3 if r[y]<r[x] then
4 begin
5 y:=y xor x;
6 x:=y xor x;
7 y:=y xor x
8 end;//交换,有疑问者请参照xor的运算