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!
Here is a much simpler way :- https://mirror.codeforces.com/contest/1995/submission/272131540 Its pretty easy to understand too, but let me know if you dont get 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.
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