![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
单调栈
苏子散人
爱古风,爱代码。
展开
-
hdu 1506(单调栈实现)
#include #include #include using namespace std; struct node{ int w=1; long long h; }s[100005]; int main() { int n; while(scanf("%d",&n)!=EOF&&n) { int i; stackst; for(i=0;i<n;i++) { scanf("%ll原创 2016-07-24 11:07:14 · 748 阅读 · 0 评论 -
codeforces 631C Report(单调栈)
//题解:如果第j个操作在第i个操作后面且rj>=ri,则第i个操作可视为无效操作,根据操作区间长度 //建立一个递减的单调栈,只需改变相差区间的数的排列顺序 #include #include using namespace std; const int maxn=200005; long long a[maxn],b[maxn]; int q[maxn],t[maxn],r[maxn];原创 2016-07-24 16:05:13 · 312 阅读 · 0 评论