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:DP的话貌似很容易超时阿。

Posted by gzw_02 at 2008-07-26 21:44:34 on Problem 2313
In Reply To:这个题可以用dp做(前提是下属猜想成立),见内 Posted by:dugushuiyi at 2008-07-03 15:51:23
正确性尚且不考虑,如果不加优化用DP, 
用V[i,j]表示取B(i)=j的时候V的最优值。  
V[i,j]= min(V[i-1,k]+abs(j-k)+abs(A(i)-j))(-10000<=k<=10000)
这样, 
100×10000×10000×4
超时是很容易的。

不知怎样优化呢?

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