bzoj#P2453. 维护队列

维护队列

题目描述

维护一个整数队列,支持以下操作:

  • push x:把 xx 放入队尾;
  • pop:若队列非空,弹出队首元素,否则什么也不做;
  • front:输出队首元素(若队列为空输出 -1);
  • size:输出队列中元素个数;
  • empty:队列为空输出 Yes,否则输出 No。

输入格式

第一行一个整数 mm(1≤m≤2000001\le m\le 200000)。

接下来 mm 行,每行一个上述操作(∣x∣≤109|x|\le 10^9)。

输出格式

对每个 front、size、empty 操作输出一行结果。

样例输入

9
push 5
push 7
front
size
pop
front
empty
pop
front

样例输出

5
2
7
No
-1