C. Make It Equal
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
There is a toy building consisting of nn towers. Each tower consists of several cubes standing on each other. The ii-th tower consists of hihi cubes, so it has height hihi.
Let's define operation slice on some height HH as following: for each tower ii, if its height is greater than HH, then remove some top cubes to make tower's height equal to HH. Cost of one "slice" equals to the total number of removed cubes from all towers.
Let's name slice as good one if its cost is lower or equal to kk (k≥nk≥n).
Calculate the minimum number of good slices you have to do to make all towers have the same height. Of course, it is always possibl