SuperMo's blog

By SuperMo, history, 6 months ago, In English

Hi in problem B of last contest the answer is ∑(pi−ai)+max(pi−ai) now I don't get the max(pi−ai) part I know what it's but I don't know how did we derive it can someone help ?

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

for adding 1 to the k elements you select need to add k+1 to your score right, so the number of turns of selecting k elements is basically the max element difference , so for each turn u spend 1 extra so the number of turns are max(pi-ai) so hence its max(pi-ai) extra

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    ok thanks, It clicked after reading the comment for several times the problem is that I did it with a completely different approach so it was hard for me to understand this

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Maths