#P15681. 分糖果
分糖果
Problem Description
You are given a sequence of length and operations. There are two types of operations in total:
- Given , you need to modify the value of to .
- Given , you need to compute the following: suppose there are currently baskets and people. The -th person will choose distinct baskets and put candy into each of these baskets. Find the maximum possible number of baskets that end up with exactly candies.
Input Format
The first line contains three integers , where denotes the test point ID. The samples satisfy .
The second line contains integers .
The next lines each contain three integers, in the form or , representing the first type of operation and the second type of operation, respectively.
Output Format
For each operation of the second type, output one line containing one integer, which is the answer.
0 3 4
1 2 5
2 5 2
1 3 3
2 4 1
2 5 0
3
3
2
Hint
Explanation for Sample 1
- For the first operation, , , . Person can choose to put candy into basket . Person can choose to put candy into basket and basket . Person can only choose to put candy into all baskets. Then baskets each have exactly candies. It is easy to prove that this maximizes the number of baskets with exactly candies.
- For the third operation, , , . Person can choose to put candy into basket . Person can choose to put candy into basket and basket . Person can choose to put candy into baskets . Then baskets each have exactly candy. It is easy to prove that this maximizes the number of baskets with exactly candy.
- For the fourth operation, , , . Person can choose to put candy into basket . Person can choose to put candy into basket and basket . Person can choose to put candy into baskets . Then basket and basket each have exactly candy. It is easy to prove that this maximizes the number of baskets with exactly candies.
Sample 2
See candy/candy2.in and candy/candy2.ans.
This sample set satisfies the constraints of test point .
Sample 3
See candy/candy3.in and candy/candy3.ans.
This sample set satisfies the constraints of test point .
Sample 4
See candy/candy4.in and candy/candy4.ans.
This sample set satisfies the constraints of test point .
Sample 5
See candy/candy5.in and candy/candy5.ans.
This sample set satisfies the constraints of test point .
Sample 6
See candy/candy6.in and candy/candy6.ans.
This sample set satisfies the constraints of test point .
Sample 7
See candy/candy7.in and candy/candy7.ans.
This sample set satisfies the constraints of test point .
Sample 8
See candy/candy8.in and candy/candy8.ans.
This sample set satisfies the constraints of test point .
Constraints
For all testdata, it is guaranteed that:
- .
- .
- , .
- , .
::cute-table{tuack}
| Test point ID | Special property | |
|---|---|---|
| A | ||
| B | ||
| BC | ||
| None | ||
| BC | ||
| B | ||
| C | ||
| None | ||
| BC | ||
| B | ||
| C | ||
| None | ||
| A | ||
| BC | ||
| B | ||
| C | ||
| None |
- Special property A: it is guaranteed that .
- Special property B: it is guaranteed that .
- Special property C: it is guaranteed that there is no operation of the first type.
Translated by ChatGPT 5