单调队列
西行妖下的亡灵
这个作者很懒,什么都没留下…
展开
-
POJ 2823 silding window(滑动窗口)(单调队列)
An array of sizen≤ 106is given to you. There is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers in the window. Each time...原创 2019-08-30 20:54:46 · 146 阅读 · 0 评论 -
JOYOI 最大子序和(单调队列)
输入一个长度为n的整数序列,从中找出一段不超过M的连续子序列,使得整个序列的和最大。例如1,-3,5,1,-2,3当m=4时,S=5+1-2+3=7当m=2或m=3时,S=5+1=6本题是一个单调队列的问题,准确来说是前缀和+单调队列。为啥要单调队列呢?我们来康康这个问题的意思:从一个序列里找一个子序列的和使得它是所有子序列和里边最大的那个。既然提到了区间和,那就用前缀和来简...原创 2019-08-30 23:15:38 · 255 阅读 · 0 评论