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

写kluskal WA的人注意下

Posted by Zealot1024 at 2009-05-25 20:54:55 on Problem 2421
我是因为
i=cnt=0;
while(cnt<n-1-q)
{
	if( getf(e[i].a) != getf(e[i].b) )
	{
		unite(e[i].a,e[i].b);
		sum+=e[i].p;
		cnt++;
	}
	i++;
}
while里面的条件应该为错了,应该注意已经修好的q条路中有可能是环路,所以我改为(cnt<n-1)就过了

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