Problem B
Racing Game
A certain game company famous for its PR stunts have just announced a new arcade racing game concept. Honestly, it is just like a standard racing game: players compete to finish each race in the fastest time, and they are ranked on a scoreboard based on their time. However, there is a twist: the company may sometimes increase or decrease all of the time records they have. "It is to motivate new players to try our game", they said.
As a game developer for that company, you are ordered to take care of the scoreboard system. Formally, you need to handle three types of operations:
-
Put a new time record
into the scoreboard. -
Add
to all existing time records on the scoreboard. Note that this might make some time records to be negative. -
Find the
-th fastest time record on the scoreboard. Due to performance concerns, is at most .
Now, you have to run your program on
Input
The first line contains one integer
The next
-
( ), meaning we have to put an integer to the scoreboard. -
( ), meaning we have to add an integer to all existing time records. -
( ), meaning we have to output the -th fastest time record on the scoreboard. It is guaranteed that there are at least time records on the scoreboard.
Output
For each "
Subtasks
-
(
Points): , and for each " " operation. -
(
Points): . -
(
Points): There is no " " operation, and for each " " operation. -
(
Points): There is no " " operation. -
(
Points): for each " " operation. -
(
Points): No additional constraints.
Explanation
In the first sample, below is what happened on each operation:
-
We put
to the scoreboard. Hence, the scoreboard now contains . -
We have to output the
st fastest time record, which is . -
We add
to all time records. Thus, the scoreboard becomes . -
We have to output the
st fastest time record, which is . -
We put
to the scoreboard. Hence, the scoreboard now contains . -
We have to output the
nd fastest time record, which is . -
We put
to the scoreboard. Hence, the scoreboard now contains . -
We add
to all time records. Thus, the scoreboard becomes . -
We have to output the
nd fastest time record, which is .
Warning
The I/O files are large. Please use fast I/O methods.
Sample Input 1 | Sample Output 1 |
---|---|
9 1 11 3 1 2 29 3 1 1 97 3 2 1 0 2 -10 3 2 |
11 40 97 30 |
Sample Input 2 | Sample Output 2 |
---|---|
11 1 1 2 -101 1 50 1 0 2 32 1 32 2 -1 3 1 3 2 3 3 3 4 |
-69 31 31 81 |