Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:做过的人帮忙找原因,代码很容易看懂!!!In Reply To:做过的人帮忙找原因,代码很容易看懂!!! Posted by:caizhicong0503 at 2008-08-04 17:47:32 void Union(int x,int y) { int rootx = find(x); int rooty = find(y); if(rootx == rooty) return ; if(rank[x]>rank[y]) Father[y] = x; else { Father[x] = y; if(rank[x] == rank[y]) rank[x]++; } } -> void Union(int x,int y) { int rootx = find(x); int rooty = find(y); if(rootx == rooty) return ; Father[Father[x]] = Father[y]; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator