Problem Description
Loading...
Problem Analysis
N people take part in a game. In each round, one person must step out to act as the supervisor, and the remaining N-1 people are players. The i-th person requires that they be a player at least ai times. What is the minimum number of rounds the game must run?
Binary Search on whether x rounds can be completed.
To check a candidate answer x, first add up everyone’s requirements to get sum, then test x*n-sum. If this value is greater than or equal to x, the answer is feasible, because this value represents the maximum number of supervisor turns these people can provide; as long as the number of supervisor turns can reach x, x rounds can be played.
cpp
| |