啊啊!!!爆零!!!求调!!!必关!!!啊啊!!!
查看原帖
啊啊!!!爆零!!!求调!!!必关!!!啊啊!!!
1051936
suizihan1226楼主2024/8/27 16:57
#include<bits/stdc++.h>
using namespace std;
int n;
int flag,x,top;
int f[200005];
int main()   
{   
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>flag;
        if(flag==0)
        {
           cin>>x;
           f[++top]=max(f[top-1],x);
        }
        else if(flag==1&&top!=0)
		{
		        top--;
		}
        else
		{
			cout<<f[top]<<endl;
		}
    }
    return 0;
}
2024/8/27 16:57
加载中...