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 sheeper at 2013-02-28 00:29:38 on Problem 1933
/*
看得懂题目的话,DP的思路应该很清晰了
dp[i][j]表示把第j条边界(boundary)设置在第i条avenue处,从第1条边界到第j条边界之间存在的含Conservals党忠实选民(opposition-friendly neighborhoods)的选区的最大数目。
状态转移方程会是
dp[i][j]=max{dp[k][j-1]+s[k][i]} 
 k取1到i(显然还可优化,进一步缩小范围,比如从j-1开始)
而s[k][i]表示将第k条和第i条avenue设置为边界中间存在的含忠实选民的选区数目,显然对每一对k,j,这个数目是一个常数,预处理时把这个数组算出来,一般都能跑得比较快,我觉得是不超时的要点之一
另外第一条和最后一条边界一定要设置在第1条和第100条avenue处,这是看题解才知道的。。。。还是要对题目理解
*/

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