Editorial for COCI '14 Contest 4 #3 Pripreme
Submitting an official solution before solving the problem yourself is a bannable offence.
Let us denote the largest element of the input array with and the sum of the array with . Let us observe the following two cases:
The lower bound to the solution of the task is clearly and such a solution can always be achieved in this case. If we sort the elements of the input array and denote them with integers from (smallest) to (largest), then one of the optimal arrangements is: Ante and Goran .
This inequality can be written as or, in other words, the time required for the slowest team is larger than the sum of times of all other teams.
The lower bound to the solution in this case is because both lecturers have to give their lecture to the slowest team and can't do so at the same time. In this case too, it is possible to always achieve the lower bound. Let Ante first give the lecture to the slowest team, while Goran gives his lecture to all the other teams and waits for Ante to finish. After that, Goran takes over the slowest team and Ante the rest of the teams.
Comments