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

三维dp难道不可以?

Posted by ZCJ at 2015-04-27 09:14:55 on Problem 3661
用了三维dp,dp[i][j][k]表示在第i天,疲劳值为j,跑步状态为k的最大值。k=0表示这一天没有跑步,k=1表示这一天有跑步。用了滚动数组后的转移方程是
if(j>1) 
{
	dp[k][j][1]=maxed(dp[k^1][j-1][1]+d[i],dp[k][j][1]);
}
else if(j==1) dp[k][j][1]=dp[k^1][j-1][0]+d[i];

if(j<m)
{
	dp[k][j][0]=maxed(dp[k^1][j+1][1],dp[k^1][j+1][0]);
	if(j==0) dp[k][j][0]=maxed(dp[k][j][0],dp[k^1][j][0]);
}
然后一直wa了,不知道这样错在哪里?

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