#P2174. 小Z的神奇数列
小Z的神奇数列
Description
You need to maintain a multiset that supports five operations:
D xDelete ; it is guaranteed that exists. If there are multiple occurrences, delete only one.BQuery the maximum value in the set.SQuery the minimum value in the set.MLet the maximum be and the minimum be ; query .TQuery the product of all numbers, modulo .
For all queries, the multiset is guaranteed to be non-empty.
Input Format
The first line contains two positive integers , the initial multiset size and the number of operations.
The second line contains positive integers , the initial multiset.
Then lines follow, each describing one operation.
Output Format
For each query, output one integer per line representing the answer.
3 6
2 6 9
M
D 9
B
S
M
T
81
6
2
36
12
Hint
Constraints
For partial testdata, , , .
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号