单调栈与单调队列
单调栈与单调队列
Dream-chasing ant
鄙人水平不高,建立博客初心只是想留一份回忆给自己。
展开
-
单调栈
文章目录[P5788 【模板】单调栈](https://www.luogu.com.cn/problem/P5788) 和单调队列类似,保证id和val的单调性即可,但入栈和出栈是同一边。 **它用于 解决:**可以从左/右遍历第一个比它小/大的元素的位置 P5788 【模板】单调栈 #include<bits/stdc++.h> using namespace std; typede...原创 2020-03-12 18:23:54 · 152 阅读 · 0 评论 -
单调队列
文章目录[P1886 滑动窗口 /【模板】单调队列](https://www.luogu.com.cn/problem/P1886)[P1440 求m区间内的最小值](https://www.luogu.com.cn/problem/P1440)[P2032 扫描](https://www.luogu.com.cn/problem/P2032) 单调队列是对优先队列的改良。单调队列既可以从队首出队...原创 2020-02-02 11:11:27 · 97 阅读 · 0 评论