#P5986. [PA 2019] Szprotki i szczupaki
[PA 2019] Szprotki i szczupaki
Description
There are small fish in a lake. The weight of the -th small fish is .
There are operations. Each operation is one of the following types:
1 s kSuppose a big shark with weight arrives now. Its goal is to make its weight at least (including ). Ask for the minimum number of small fish it needs to eat. If the shark’s current weight is strictly greater than the weight of a small fish, then it can eat that fish and increase its own weight by .2 wAdd a small fish with weight .3 wDelete a small fish with weight . It is guaranteed that at least one such fish exists.
Input Format
The first line contains a positive integer .
The second line contains positive integers .
The third line contains a positive integer .
The next lines each contain several integers describing an operation.
Output Format
For each query, if there is a solution, output one integer per line: the minimum number of small fish that need to be eaten. If there is no solution, output -1.
4
1 4 8 1
15
1 2 3
1 2 4
1 2 5
1 3 3
1 3 5
1 3 16
1 4 16
1 8 17
1 100 101
1 100 115
1 3 9
2 2
1 3 9
3 4
1 3 9
1
2
-1
0
2
4
3
2
1
-1
3
2
-1
Hint
For of the testdata, , , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号