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

感觉上取模是不是有点太专了!

Posted by Iambitious at 2006-03-29 12:09:49 on Problem 1014
应该是一道很基本的dp,加上一些剪枝就可以了,状态就是当选择完权值为i的元素后(遍历所能选择的个数)所组成的和是多少,用一个2维数组来表示,最多有7 * (20000 * 6)个状态,由于每个阶段k都需要由第K-1个阶段的u个状态(u为权值为k的元素的个数),所以分支很多,需要剪枝,剪枝比较显然,对于阶段0,1,2都可以直接算出来,具体效果如下:java:无剪枝tle,加上剪枝0,1 1.7秒,加上2 0.9秒。
note:2维数组可以声明为short型来节省空间,不清楚c++可不可以声明这么大的数组。

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