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 |
Re:请教一下这题最优解的结构,想不通,直接搜过了,不过太慢了In Reply To:请教一下这题最优解的结构,想不通,直接搜过了,不过太慢了 Posted by:Loger at 2004-04-17 22:16:44 首先是做表来支持O(1)查询某个子式的和 枚举+二维压缩成一维需要O(n^2) 在一维上dp,dp方程s[k]=max(s[k-1],0)+a[k],需要O(n) 总共O(n^3),考虑规模n<=100,先鄙视一下,然后就做吧 > 不知怎样用dp来做,可以指教一下? Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator