Submit solution

Points: 100
Time limit: 2.0s
Memory limit: 256M

Problem type

Set

You have q queries and an empty set. Each query is of the form:

  • ADD x: Add x to the set
  • ERASE x: Erase x from the set
  • NTH n: Output the n-th smallest number in the set (1-indexed)
  • MIN: Output the minimum value in the set
  • MAX: Output the maximum value in the set

Constraints

1 \le q \le 1e5

\(\1 le x \le 1e9\)

Common sense constraints should hold (n <= size(set))

Sample Input 1

5
ADD 1
ADD 2
NTH 2
MIN
MAX

Sample Output 1

2
1
2

Comments

There are no comments at the moment.