Problem Link: Contest Page | CodeChef

Consider the problem whether the answer is less than or equal to X. This problem can be

rephrased as whether all the candy sticks can be cut down to the length less than or equal to X within at most K cuts. In order to cut a candy stick of initial length A_i

into those of length less than or equal to X, at least ⌈A_i/X⌉ −1 cuts are required. If the sum of them does not exceed K, then the answer is Yes, otherwise the answer is No.

It is sufficient to find the minimum integer X such that the answer to the question “is the

answer less than or equal to X?” is Yes. The total computation time is O(Nlog(maxA)).