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

太诡异了,2句写在一个循环里就RE,分别写在2个循环里就AC了~大牛来解释一下啊~谢谢了

Posted by justjude at 2007-11-08 00:28:56 on Problem 3463
这样可以AC~
for ( i=nbs1[k]; i ;i=next1[i] )
	{
		j  = ev1[i];
		if (value[j]+ew1[i]==value[k]) 
		{
			dp[k][0] += dfs(j);
			dp[k][1] += dp[j][1];
		}
	}
	
	for ( i=nbs1[k]; i ;i=next1[i] )
	{
		j  = ev1[i];
		if ( value[j]+ew1[i] == value[k] + 1 ) 
		{
			
			dp[k][1] += dfs(j);
		}

	}

这样就RE~
for ( i=nbs1[k]; i ;i=next1[i] )
	{
		j  = ev1[i];
		if (value[j]+ew1[i]==value[k]) 
		{
			dp[k][0] += dfs(j);
			dp[k][1] += dp[j][1];
		}
		if ( value[j]+ew1[i] == value[k] + 1 ) 
		{
			dp[k][1] += dfs(j);
		}
	}

太诡异了,2句写在一个循环里就RE,分别写在2个循环里就AC了~大牛来解释一下啊~谢谢了

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