标签:class 需要 nbsp pre com tail std 入栈 names
描述:https://www.luogu.com.cn/problem/P3467
#include <bits/stdc++.h> using namespace std; int n,a[250009],b[250009]; int q[250009],p[250009]; map<int,int>m; int ans; int main() { cin>>n; int ans=0; for(int i=1;i<=n;i++) cin>>a[i]>>b[i]; int tail=0,head=1; for(int i=1;i<=n;i++) { while(tail>=head&&q[tail]>=b[i]) { if(q[tail]==b[i]) ans++; tail--; } q[++tail]=b[i],p[tail]=i; } cout<<n-ans; }
标签:class 需要 nbsp pre com tail std 入栈 names
原文地址:https://www.cnblogs.com/iss-ue/p/12538509.html