atcoder#ABC253C. [ABC253C] Max - Min Query
[ABC253C] Max - Min Query
Score : points
Problem Statement
We have a multiset of integers , which is initially empty.
Given queries, process them in order. Each query is of one of the following types.
1 x
: Insert an into .2 x c
: Remove an from times, where the number of 's contained in .3
: Print maximum value of minimum value of . It is guaranteed that is not empty when this query is given.
Constraints
- When a query of type
3
is given, is not empty. - All values in input are integers.
Input
Input is given from Standard Input in the following format:
, which denotes the -th query, is in one of the following formats:
Output
Print the answers for the queries of type 3
in the given order, separated by newlines.
8
1 3
1 2
3
1 2
1 7
3
2 2 3
3
1
5
4
The multiset transitions as follows.
- -st query: insert into . is now .
- -nd query: insert into . is now .
- -rd query: the maximum value of is and its minimum value is , so print .
- -th query: insert into . is now .
- -th query: insert into . is now .
- -th query: the maximum value of is and its minimum value is , so print .
- -th query: since there are two 's in and , remove from twice. is now .
- -th query: the maximum value of is and its minimum value is , so print .
4
1 10000
1 1000
2 100 3
1 10
If the given queries do not contain that of type , nothing should be printed.