Need help understanding a greedy solution

Правка en1, от aj116, 2017-04-20 18:19:21

I was solving this question: http://mirror.codeforces.com/contest/479/problem/B

The output specification states that: "Note that in the process of performing operations the heights of some towers can become equal to zero."

Consider the second test case:

3 4

2 2 4

We can arrive at a better solution than the one given by doing the following operations:

1 2

1 2

Now the towers are: 4 4 with instability 0 (as tower 1 no longer exists). But the answer states minimum as 1.

Can somebody please help me understand what I am misunderstanding here?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский aj116 2017-04-20 21:47:44 431 Tiny change: ' here?\n\nEDIT: So I unde' -> ' here?\n\n**EDIT:** So I unde'
en1 Английский aj116 2017-04-20 18:19:21 605 Initial revision (published)