|
Time |
Memory |
Case 1 |
1 sec |
32 MB |
Case 2 |
1 sec |
32 MB |
Case 3 |
1 sec |
32 MB |
Case 4 |
1 sec |
32 MB |
Case 5 |
1 sec |
32 MB |
Case 6 |
1 sec |
32 MB |
Case 7 |
1 sec |
32 MB |
Case 8 |
1 sec |
32 MB |
Case 9 |
1 sec |
32 MB |
Case 10 |
1 sec |
32 MB |
Case 11 |
1 sec |
32 MB |
Case 12 |
1 sec |
32 MB |
Description
You find that everybody has already had a black box, but you don't think you have earned enough money, so you decide to invent a new black box -- "white box". The white box has one more function than the black box -- it can answer you which number has the most in it.
All operations you can do to the white box are as follow:
- 1 k x: add number x into the box k times
- 2 k x: remove number x in the box k times, if number x in box is fewer than k, just remove all x
- 3 x: ask how many x are in the box
- 4: ask the maximum number in the box, if there are no number in the box, the box will answer you "The box is empty."
- 5: ask the minimum number in the box, if there are no number in the box, the box will answer you "The box is empty."
- 6: ask the most number and its occurences in the box, if there are more than one number has the most occurences, the answer will be the largest one, if there are no number in the box, the box will answer you "The box is empty."
If you want to earn more money(or simply want to pass this course), please make the magical white box.
Input
The first line contains an integer N -- the number of operations you will do to the black box.
The next N lines will be the operations as above.
1 <= k <= 1e9.
-1e9 <= x <= 1e9.
For testcase 1~3: 1 <= N <= 1e3.
For testcase 4~6: 1 <= N <= 2e5.
Output
For operation 3 ~ 6, please output the corresponding answer.
Tags