Codeforces 246B. Increase and Decrease



Problem link

Note, that you can always get the answer n–1. To get this result you should make first n–1 equal using the last element as the second element in pair of the given operation. But after it, the whole array could become equal. It could happen if the sum of the array’s elements is divisible by n. So the answer is n–1 or n.

A solution in c++


Post a Comment

0 Comments