Loading...
Loading...
Loading...
An agent has n queues of tickets, and queue i holds queues[i] tickets. Each hour the agent picks one queue and clears up to s tickets from it. Leftover time in an hour is wasted. Print the smallest whole s that clears all queues within the given hours.
Example
Input
4 8 3 6 7 11
Output
4
Try the problem first. Open one hint at a time.
A higher speed never needs more hours, so search the speed between 1 and the largest queue.
Hours for a speed s: add (queue + s - 1) // s for every queue.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor