随笔分类 -  单调队列

摘要:题意 有M篇标准作文组成了一个作文库(每篇作文都是一个01的字符串),然后给出N篇作文(自然也是01字符串)。如果一个长度不小于L的串在作文库中出现过,那么它是熟悉的。对于某一篇作文,我们要把它分为若干段,使得熟悉过的字符串长度>=百分之90,我们要求满足这个条件的最小的L。 分析 这个L显然满足二 阅读全文
posted @ 2018-11-01 20:46 蒟蒻LQL 阅读(253) 评论(0) 推荐(0)
摘要:题意 将一段序列分割为任意段,每一段的连续和不超过M,使得每一段最大值的和最小. 分析 用单调队列进行优化的dp。单调队列可以维护可以影响当前区间的最大值。 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #incl 阅读全文
posted @ 2018-04-14 00:07 蒟蒻LQL 阅读(437) 评论(0) 推荐(1)
摘要:分析:这个题的关键是要找到,当某个值是最小值时它最大的影响区间时什么。可以通过单调队列(单调栈)在nlogn的时间内实现 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <iostream> 5 # 阅读全文
posted @ 2018-04-14 00:05 蒟蒻LQL 阅读(315) 评论(1) 推荐(1)
摘要:题意:There is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the ma 阅读全文
posted @ 2018-04-14 00:04 蒟蒻LQL 阅读(125) 评论(0) 推荐(1)
摘要:题意given a circle sequence A[1],A[2],A[3]......A[n]. Circle sequence means the left neighbour of A[1] is A[n] , and the right neighbour of A[n] is A[1] 阅读全文
posted @ 2018-04-14 00:01 蒟蒻LQL 阅读(249) 评论(0) 推荐(2)
摘要:题目给出N个数,找出一段区间使得区间最小值乘区间和的值最大 其中N<=100000 分析: 单调队列(单调栈) 求出每个值作为最小值时最长的影响区间,然后枚举判断 这找出最长影响区间应该算是单调队列的最典型的用法了~ 具体来说就是入队的时候可以得到影响区间的最左边,出队列的时候可以得到影响区间最右边 阅读全文
posted @ 2018-04-03 17:37 蒟蒻LQL 阅读(211) 评论(0) 推荐(1)