POJ 2559Largest Rectangle in a Histogram(单调栈入门)
题意:见标题
思路:维护一个单调递增栈,遍历[0,n-1] 遇到a[i]>a[s.top()]直接入栈,否则计算矩形面积。
#include<cstdio>
#include<stack>
using namespace std;
typedef long long ll;
const int maxn = 1e5+5;
stack<int> st...
原创
2019-08-15 10:51:25 ·
111 阅读 ·
0 评论