RT,调了四十分钟了,一直re,求助路过的大佬们
#include<bits/stdc++.h>
using namespace std;
stack<int>a;
stack<int>b;
int n,w,ww;
int main(){
cin>>n;
while(n--){
cin>>w;
if(w==0){
cin>>ww;
a.push(ww);
if((ww>b.top())||b.empty()) b.push(ww);
else b.push(b.top());
}else{
if(w==1){
a.pop();
b.pop();
}else{
if(b.empty())cout<<0<<endl;
else cout<<b.top()<<endl;
}
}
}
return 0;
}
```