This problem is in Contest(s) below:
Contest 1021:栈和队列