12537 - The power of vector   

Description

You are going to maintain a data structure V that each element is a int.

Give you n orders. There're four types of order

push_back:

The order will followed by a int. Push the int to the back of V.

pop_back:

Delete a int at the back of V .

If the vector is empty, do nothing.

find

The order will followed by a int means the index. Print the number V[ int ].

The index is start from 1.

If the index is invaild, do nothing.

min:

Print the smallest number in V. Print the number and its index. If you find multiple answer, print the number with smallest id.

If the vector is empty, do nothing.

max:

Print the biggest number in V. Print the number and its index. If you find multiple answer, print the number with biggest id.

If the vector is empty, do nothing.

 

 

Download the C++ reference.
You will see the file named "12534.cpp" but that's OK.
Just download the file and change the filename extension(副檔名) into "zip" then you can upzip the file and use the reference.
The link is below.

reference.zip

Input

The first line contains only one integer n(1 <= n <= 200000)

The following n lines each lines contains order as the description described.

Each number is in the range of int.

Output

For each order print as demand.

Remember to print \n at the end of each output.

Sample Input  Download

Sample Output  Download

Tags




Discuss