Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:哪里错了啊 请大牛指点

Posted by yy17yy at 2011-04-30 06:50:24 on Problem 2054
In Reply To:哪里错了啊 请大牛指点 Posted by:tangbohu222 at 2011-03-26 15:52:09
for(int j=1;j<=N;j++)//
		{
			if(father[j]==temp)
				father[j]=father[temp];
		}
这里有问题,,,,temp不仅仅代表的是一个点,,,是一个集合,,,你这样做,,,仅仅是把temp这个集合里的最父亲节点的孩子更新了,,,这个集合里其他节点的孩子没有更新,,,因为我也犯了这个错误,,,

另外应避免精度问题,,,

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator