aj116's blog

By aj116, history, 9 days ago, In English,

I was solving this question: http://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?

EDIT: So I understood that I should not have assumed that a tower with no blocks will not exist. I am now interested in this variant:

Suppose a tower with no blocks ceases to exist. How would one solve this problem now? I tried but could not come on with a working solution. Example: There are 3 towers initially: 2 5 7. Suppose we can only move two blocks. Then we can achieve zero instability. Any help is appreciated.

  • Vote: I like it  
  • -5
  • Vote: I do not like it  

9 days ago, # |
  Vote: I like it +5 Vote: I do not like it

Lol, when tower height becomes 0 it doesn't disappear, you can't add details to problem by yourself :D

  • »
    9 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Ok Reol. Just seemed logical that tower would not exist if all its blocks were placed somewhere else.

    BTW, suppose the towers did disappear if their height became 0. Do you know how this variant can be solved? I tried solving it but could not come up with a working solution.

    Thanks for your reply.

9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by aj116 (previous revision, new revision, compare).