#include<bits/stdc++.h>
using namespace std;
int n,opt,stk[200005],top=0,x,stk2[200005],top2=0;
int main(){
cin>>n;
while(n--){
cin>>opt;
if(opt==0){
cin>>x;
stk[++top] = x;
if(top==0 || x>=stk2[top2] ){
stk2[++top2] = x;
}
}else if(top!=0 &&opt == 1){
//if(top!=0){
if(stk[top] == stk2[top2]){
top2--;
}
top--;
//}
}else{
cout<<stk2[top2]<<"\n";
}
}
return 0;
}
判断else if那里,写else if(top!=0&&opt==1)不对
但是把top!=0放到下一行单独写(我注释的地方)就对了 请问这是为什么