3224: tyvj 1728 normal balance tree time limit: 10 sec memory limit: 128 MB
Submit: 1844 solved: 727
[Submit] [Status] Description
You need to write a data structure (refer to the title of the question) to maintain the number. The following operations are required:
1. insert X Data
2. Delete the number of X (if there are multiple identical numbers, because only one is deleted)
3. query the ranking of the number of X (if there are multiple identical numbers, the output is the smallest ranking)
4. query the number of X
5. Evaluate the precursor of X (the precursor is defined as less than X and the maximum number)
6. Find the successor of X (defined as the number greater than X and the smallest number)
Input
The first behavior n indicates the number of operations. Each row in the N rows below has two numbers OPT and X, and opt indicates the number of operations (1 <= opt <= 6)
Output
For operations 3, 4, 5, 6, each row outputs a number, indicating the corresponding answer
Sample input10
1 106465
4 1
1 317721
1 460929
1 644985
1 84185
1 89851
6 81968
1 492737
5 493598
Sample output106465
84185
492737
Hint
1. Data range of N: n <= 100000
2. Data range of each number: [-1e7, 1e7]
Question: RT
Idea: I used treap to solve the naked Question of the Balance Tree. Because I missed a single character when I typed the rot, the infinite re, sad ~, You have to be careful when you finish running for 412 Ms.
There is a pitfall in this question. For Operation 3, we need to find the minimum ranking. For example, if there are 1, 3, 3, 5, then we need to output 2 after 3, there is nothing else to pay attention to. Just open the writing ~
Bzoj3224 (treap)