Pro.ID22160 TitlePPMM Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22160 AC0 Submit21 Ratio0.00% 时间&空间限制描述Suppose there is a queue, in which we could do some operations as follow: PUSH X : Means that enqueue a number X ( -231 < X < 231 ) to the tail of the queue. POP : Means that dequeue a number from the head of the queue. MINUS : Means that form each number in the queue to its corresponding inverse number, viz. X = -X. MAX : Means that return the maximum number in the queue. Notice that for operations POP, MINUS and MAX, if it is no numbers current in the queue, just ignore them. Given a sequence of operations, then for each "MAX" operation, if this operation is not ignored, you should output the maximum value it returned. 输入The first line of input there is one integer T ( T ≤ 10 ), giving the number of test cases in the input. For each test case, the first line contains a number N ( N ≤ 2000000 ), representing the quantity of operations. The following N lines give out the detail. 输出Description Suppose there is a queue, in which we could do some operations as follow: PUSH X : Means that enqueue a number X ( -231 < X < 231 ) to the tail of the queue. POP : Means that dequeue a number from the head of the queue. MINUS : Means that form each number in the queue to its corresponding inverse number, viz. X = -X. MAX : Means that return the maximum number in the queue. Notice that for operations POP, MINUS and MAX, if it is no numbers current in the queue, just ignore them. Given a sequence of operations, then for each "MAX" operation, if this operation is not ignored, you should output the maximum value it returned. Input The first line of input there is one integer T ( T ≤ 10 ), giving the number of test cases in the input. For each test case, the first line contains a number N ( N ≤ 2000000 ), representing the quantity of operations. The following N lines give out the detail. Output For each "MAX" operation not ignored, output the returned number in a line. Output a blank line between the test cases. Sample Input 1 Sample Output 2 Source 样例输入1 样例输出2 作者 |