Given the number of people in several cashiers' lines, find the earliest time when all customers can be processed after choosing one line strategy.
You are given several cashier queues. Each queue has a certain number of people waiting, and each cashier serves one person per unit of time.
You need to determine the minimum time needed to finish serving everyone if you can choose a single cashier line to join and then wait through the process implied by the problem setup.
For practice, think about how the total workload and the best queue choice affect the final time.
Compute the earliest completion time according to the described cashier-line process.
Example 1
Input
3 3 1 2
Output
1
Explanation
The smallest line already has 1 person, so the earliest completion time is determined by that best choice.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.