This is an editorial for CODE-O-FIESTA contest held for students of SVIT, Vasad.
Contest link

Problem 1: Plus One

  • Explanation:
    Let’s sort the numbers in ascending order. It becomes immediately clear that it is not profitable for us to increase the numbers that are equal to the last number (the maximum of the array). It turns out that every time you need to take such a subset of the array, in which all the numbers, except the maximums. And once for each operation, the numbers in the subset are increased by one, then how many times can the operation be performed on the array?
    Accordingly max(a)−min(a).

  • [details=“Solution”]