Description
Input
Output
Sample Input
1 2
1 3
2 2
2 5
1 4

Sample Output

用单调栈水过了……根本不知道第一维的x有什么用
#include<iostream>
#include<cstdio>
using namespace std;
int zhan[250001];
int top,a,n,sum;
int main()
{
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
scanf("%d%d",&a,&a);
while (top && zhan[top]>=a)
{
if (a==zhan[top]) sum++;
top--;
}
zhan[++top]=a;
}
printf("%d",n-sum);
}
1704




被折叠的 条评论
为什么被折叠?



