ans

WURUILANG 2022-04-24 12:13:39 21 返回题目

#include <bits/stdc++.h>
using namespace std;
stack<int> s;
int main()
{
	int n;
	cin>>n;
	int x,p;
	for(int i=1;i<=n;i++)
	{
		cin>>p;
		if(p==1)
		{
			cin>>x;
		  	s.push(x);
		}
		else
			s.pop();
	}
	if(s.empty())
		cout<<"impossible!";
	else
		cout<<s.top();
}
{{ vote && vote.total.up }}