P6704 全RE!!! 谢谢
调不出来了。。。
#include<bits/stdc++.h>
using namespace std;
stack<int>s[7];
int main(){
int n,m;
int ans=0;
cin>>n>>m;
for(int i=1 ; i<=n ; i++){
int x,y;
cin>>x>>y;
if(!s[x].empty()||y>s[x].top()){
s[x].push(y);
ans++;
}if(s[x].top()>y){
while(y>s[x].top()){
s[x].pop();
if(y<s[x].top()) ans++;
if(y==s[x].top()) break;
else{
ans++;
s[x].push(y);
break;
}
}
}
}
printf("%d",&ans);
return 0;
}
谢谢大家