#P4058. [Code+#1] 木材
[Code+#1] 木材
Description
There are trees. Initially, the -th tree has height , and every month the -th tree grows by . There is an order for a total timber length of . The client requires each piece of timber to have length at least , and each piece must be a whole tree (i.e., you cannot take only part of a tree). What is the minimum number of months you need to wait to fulfill the order?
Input Format
The first line contains non-negative integers , , separated by spaces, denoting the number of trees, the total required length, and the minimum length for a single piece, respectively.
The second line contains non-negative integers .
The third line contains non-negative integers .
Output Format
Output a single integer on one line representing the answer.
3 74 51
2 5 2
2 7 9
7
Hint
For the sample, after six months, the heights of the trees are , , , and the order cannot be fulfilled.
After seven months, the heights are , , . You can then cut down the -nd and -rd trees to fulfill the order.

From CodePlus 2017 November Contest, proudly presented by the Student Association for Algorithms and Competitions, Department of Computer Science and Technology, Tsinghua University.
Credit: idea/Zheng Linkai, problem setter/Zheng Linkai, tester/Wang Yuzhong.
Git Repo: https://git.thusaac.org/publish/CodePlus201711
Thanks to Tencent for supporting this contest.
Translated by ChatGPT 5
京公网安备 11011102002149号