Блог пользователя CandidFlakes

Автор CandidFlakes, история, 5 часов назад, По-английски

This is the problem. This is my WA attempt.

What I am tying to do is first count how many maximum can be formed by x and x+1 each. Then, check if it is possible to decrease some amount of x+1 and increase some amount of x so that the overall answer increases. Please help me find where I am doing wrong?

I will be thankful for any help!

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
5 часов назад, # |
Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

Here is a much simpler way :- https://codeforces.com/contest/1995/submission/272131540 Its pretty easy to understand too, but let me know if you dont get it :)

  • »
    »
    5 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Thanks so much for reply!

    I was looking to improve my incorrect solution. I went through editorial and found that they did something similar but their code is inaccessible.

»
76 минут назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

My idea-store occurences in the map (freq count) then iterate through map and iterate through each count of x take the remaining you can have from x+1

take = min(mp[x+1],remain/(x+1)) and then update the ans accordingly

I got WA for directly using mp[x+1] but got AC when used mp.find(x+1) can anyone explain what could be wrong

WA- 272281735 , AC- 272282047

Thanks