#P3332. [ZJOI2013] K大数查询
[ZJOI2013] K大数查询
Description
You need to maintain multisets of integers, numbered from to .
All sets are initially empty. There are operations:
1 l r c: Add to every set with index in .2 l r c: Query the -th largest number in the union of all sets with indices in .
Note that the union of multisets does not remove duplicates, e.g., .
Input Format
The first line contains two positive integers , the number of sets and the number of operations.
Each of the next lines contains four integers describing one operation.
Output Format
For each operation of type 2, output one line with a single integer, the answer.
2 5
1 1 2 1
1 1 2 2
2 1 1 2
2 1 1 1
2 1 2 3
1
2
1
Hint
[Sample Explanation]
The 1st operation adds one to sets and .
The 2nd operation adds one to sets and .
The 3rd operation queries the 2nd largest number in set , which is .
The 4th operation queries the 1st largest number in set , which is .
The 5th operation queries the 3rd largest number in the union of sets and , which is .
Constraints
In operation 1,
In operation 2, , and the -th largest number exists.
:Added a new set of hack testdata.
Translated by ChatGPT 5
京公网安备 11011102002149号