#include<cstdio> #include<iostream> #include<queue> using namespace std; int n,k,a,t=1; int main() { queue<int>line; cin>>n; while(n--) { cin>>k; if(k==1) { cin>>a; line.push(a); } if(k==2) { if(line.empty()) { //cout<<"impossible!"<<endl; //return 0; t=0; continue; } line.pop(); } } if(line.empty()||t==0) cout<<"impossible!"<<endl; else cout<<line.front()<<endl; return 0; }
时间: 2024-10-03 21:41:35