[BZOJ1113]海报PLA-单调栈-模拟

发布于 2017-08-09  112 次阅读


#include<cstdio>
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;int s[2000];
int n;
int cnt=1;
int ans;
int main()
{
	// freopen("cover.in","r",stdin);
	// freopen("cover.out","w",stdout);
	scanf(
	ans=n;
	int x,y;
	scanf(
	s[1]=y;
	for(int i=2;i<=n;i++)
	{
		scanf(
		while(cnt>0&&s[cnt]>y) cnt--;
		if(s[cnt]==y) ans--;
		s[++cnt]=y;
	}
	printf(
}