# | Problem | Pass Rate (passed user / total user) |
---|---|---|
14368 | 2024_DS_Summer_Lab12_Order of key |
|
Description
Maintain an integer set S, which support the following operations:
- INS k: Insert k to S. If k is already in S, do nothing.
- DEL k: Delete the element in S with value k. If k is not in S, do nothing.
- ORD k: Find the number of element in S whose value is smaller than or equal to k.
Note: You may use the given template of AVL tree in the slides.
Input
The first line contains an integer q, representing the number of operations. Each of the following q lines is a single operation mentioned above.
Constraint
- 1 <= q <= 3 x 105
- 1 <= k <= 109 for every operation
Subtask
- Testcases 1~5: Only INS and ORD operations
- Testcases 6~10: No further constraints
Output
For each ORD k operations, output the answer in each line.