现在的位置: 首页 > 综合 > 正文

【bzoj1113】[Poi2008]海报PLA

2018年01月13日 ⁄ 综合 ⁄ 共 407字 ⁄ 字号 评论关闭
#include<iostream>
#include<cstdio>
#include<stack>
using namespace std;
int n,a,ans;
stack<int> s;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x*=10;x+=ch-'0';ch=getchar();}
    return x*f;
}
int main(){
	n=read();
	for(int i=1;i<=n;i++){
		a=read();a=read();
		while(!s.empty()&&a<=s.top()){
			if(a==s.top())ans++;
			s.pop();
		}
		s.push(a);
	}
	printf("%d",n-ans);
	return 0;
}

抱歉!评论已关闭.