#C11613. Process Integer Queries

    ID: 40949 Type: Default 1000ms 256MiB

Process Integer Queries

Process Integer Queries

We start with an integer list that initially contains a single element, 0. You will be given a series of queries to process on this list. There are two types of queries:

  • Type 1: "1 x" - Append the integer x to the list and then sort the list in non-decreasing order.
  • Type 2: "2 k" - Output the \(k\)-th smallest number in the list (using 1-indexing).

Process the queries in the given order and, for every query of type 2, print the corresponding result on a new line.

Note: Sorting the list after every insertion is acceptable for the purpose of this problem.

inputFormat

The first line of input contains a single integer \(n\) representing the number of queries. Each of the following \(n\) lines contains a query in one of the following formats:

  • "1 x" where \(x\) is an integer to be appended to the list.
  • "2 k" where \(k\) is an integer such that you must output the \(k\)-th smallest element in the list.

outputFormat

For each query of type 2, output the corresponding integer result on a new line in the order the queries appear.

## sample
6
1 4
1 2
2 1
1 10
2 2
2 3
0

2 4

</p>