#P6105. [Ynoi2010] y-fast trie
[Ynoi2010] y-fast trie
Background
Uh... me.
The input size of this problem is about 6 MB, and the output size is about 5 MB. Please choose appropriate input/output methods.
Problem Description
Given a constant , you need to maintain a set and support operations:
- Operation 1: given , insert an element . It is guaranteed that is not in the set before this operation.
- Operation 2: given , delete an element . It is guaranteed that is in the set before this operation.
After each operation, output $\max\limits_{\substack{ i, j \in S \\ i \ne j }} \bigl( (i+j) \bmod C \bigr)$, that is, choose two different elements from and take the maximum value of their sum . If there are fewer than two elements in , output EE.
This problem is strictly online. Each must be -ed with the previous answer. If there was no previous query or the output was EE, then the previous answer is .
Input Format
The first line contains two integers .
The next lines each contain two integers or , representing an operation of type 1 or type 2.
Output Format
Output lines. The -th line is the answer after the -th operation.
7 9
1 2
1 3
1 0
1 14
2 14
2 13
1 1
EE
5
8
8
8
5
7
Hint
Idea: zhouwc, Solution: ccz181078&nzhtl1477, Code: ccz181078&nzhtl1477, Data: nzhtl1477.
Note: This problem uses bundled tests. You can get the score of a subtask only after passing all test points in that subtask.
For of the testdata, it is Sample 1.
For another of the testdata, the number of elements in the set is .
For another of the testdata, .
For another of the testdata, .
For another of the testdata, .
For of the testdata, , , .
Translated by ChatGPT 5