14371 - 2024_DS_Summer_Assignment3_pC
|
Time |
Memory |
Case 1 |
2 sec |
512 MB |
Case 2 |
2 sec |
512 MB |
Case 3 |
2 sec |
512 MB |
Case 4 |
2 sec |
512 MB |
Case 5 |
2 sec |
512 MB |
Case 6 |
2 sec |
512 MB |
Case 7 |
2 sec |
512 MB |
Case 8 |
2 sec |
512 MB |
Case 9 |
2 sec |
512 MB |
Case 10 |
2 sec |
512 MB |
Description
Maintain an integer ordered 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.
- IND k: Find the k-th smallest element in S, or report that the cardinality of S is smaller than k.
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
Output
For each IND k operations, output the answer in each line. If the cardinality of S is smaller than k. output -1.
Tags