Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
貌似是分数规划问题吧。。。如果求有最短长度限制的连续最大和子序列的是可以在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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator