#P16227. [蓝桥杯 2026 省 A] 切割木材
[蓝桥杯 2026 省 A] 切割木材
Problem Description
In the corner, an old automatic sorting machine is making a dull roaring sound.
Xiao Lan is standing by the assembly line, ready to feed a batch of wood into the machine. The distance between the machine’s baffles, , is the only adjustable parameter. Any wood piece longer than will cause the conveyor belt to jam. Clearly, the smaller the baffle distance is, the higher the transport density per unit time will be. Therefore, Xiao Lan wants to set the baffle distance as small as possible.
There are original logs. The length of the -th log is . Xiao Lan can cut these logs to meet the length requirement, but due to saw blade wear, he can make at most cuts in total. The cutting rules are as follows:
- Each cut can split one log into two pieces.
- After splitting, the two new pieces must have positive integer lengths, and their sum must equal the length of the original log.
Now, please find the minimum feasible baffle distance for Xiao Lan, such that with no more than total cuts, after cutting, the maximum length among all wood pieces does not exceed .
Input Format
The first line contains two integers and , representing the number of original logs and the maximum number of cuts.
The second line contains integers , representing the length of each original log.
Output Format
Output one integer, representing the minimum feasible baffle distance .
1 1
5
3
2 3
9 6
3
Hint
Constraints
For of the testdata, , , .
For of the testdata, , , .
For of the testdata, , , .
Translated by ChatGPT 5