Hello,
I don't understand why my solution got a TLE for problem B. Here is the solution I came up with during the contest: 299645061. I'm quite sure the complexity is O(nlogn) but maybe I'm wrong. Here is another solution that doesn't use del: 299814673 even though if I remember correctly the complexity of del is O(1).
Does anyone have similar results?








You got hacked due to hash collisions blowing up your map/dictionary (which Counter is basically). See this blog.
Best way I found of fixing this was to just use str(yourInt) as the keys.
There is also an anti hash test for strings
Any transformation of the key would also work, for example xor by a random integer constant
quit python learn c++ = no more headache
If you wrote unordered_map in this problem in C++ you do also still get a TL :)
Actually python
dictworked perfectly fine !299628814
if you don't sort the array, your solution will TL
sorting the array is necessary ?
idk how it works, but somehow this happens
with sorting the array [AC]: https://mirror.codeforces.com/contest/2057/submission/299941291
without sorting [TL]: https://mirror.codeforces.com/contest/2057/submission/299941087
nvm , wrong
take a look at this
https://mirror.codeforces.com/contest/2057/submission/299943438
after looking carefully , your code is same as mine but the wrong is with this
UPD
jeroenodb told me probably I was lucky that I sorted the values.
I use c++ but i got TLE because i use unordered_map