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 lwyzdxh at 2010-05-07 16:21:10 on Problem 2018
如果求有最短长度限制的连续最大和子序列的是可以在O(n)解决的;
答案ans的上界是2000*1000=2000000,下界是1;
假设答案起止点分别为i,j,那么
sum[i,j]/(i-j+1)=ans
也就是说
sum[i,j]-ans*(i-j+1)=0;
二分查找答案,ans
设原数列为a0
构造新数列a(a[i]=a0[i]-ans)
则新数列连续最大和子序列的和为0时,ans为解

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