题目描述 Description
给定一个队列(初始为空),只有两种操作入队和出队,现给出这些操作请输出最终的队头元素。 操作解释:1表示入队,2表示出队
输入描述 Input Description
N(操作个数)
N个操作(如果是入队则后面还会有一个入队元素)
具体见样例(输入保证队空时不会出队)
输出描述 Output Description
最终队头元素,若最终队空,输出”impossible!”(不含引号)
样例输入 Sample Input
3
1 2
1 9
2
样例输出 Sample Output
9
#include<iostream>
#include<cstdio>
using namespace std;
const int maxn=1000+1;
int a[maxn],k[maxn];
int n,head=