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

这题起始点是任意的,判环用BF更好点

Posted by gyarenas at 2012-08-17 14:46:14 on Problem 3621
bool bm()
{
	memset(dist+1, 0, sizeof(dist[0])*L);
	for(int i = 1; i < L; ++i)
	{
		bool flag(true);
		for(int j = 0; j < rear; ++j)
			if(dist[u[j]]+w[j] < dist[v[j]])
			{
				dist[v[j]] = dist[u[j]]+w[j];
				flag = false;
			}
		if(flag)
			return false;
	}
	for(int j = 0; j < rear; ++j)
		if(dist[u[j]]+w[j] < dist[v[j]])
			return true;
	return false;
}

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