哪里超时了
查看原帖
哪里超时了
1572649
jhwyheng123楼主2024/12/19 21:19
#include<bits/stdc++.h>
using namespace std;
int st[200005];
int n,top=-1;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int a,x;
		cin>>a;
		if(a==0){
			cin>>x;
			st[++top]=x;
		}else if(a==1){
			top--;
		}else if(a==2){
			int max=0;
			for(int j=0;j<=top;j++){
				if(max<=st[j]){
					max=st[j];
				}
			}
			cout<<max<<endl;
		}
	}
	return 0;
}
2024/12/19 21:19
加载中...