CandidFlakes's blog

By CandidFlakes, history, 5 hours ago, In English

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!

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
5 hours ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

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 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.

»
71 minute(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

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