Problem link: https://codeforces.me/problemset/problem/2060/C
1st Submission: https://codeforces.me/problemset/submission/2060/305937191
2nd Submission: https://codeforces.me/problemset/submission/2060/305932678 Language used: Python
Not an input/output related issue.
After my submission, I checked some accepted solutions. Some of them even sort the numbers before solving. It is supposed to take nlog(n).
In any case I tried to sort the map keys, so that I don't have to iterate through all map/dictionary items. But even then I'm getting TLE. Is it the choice of data structure?
Can someone help me understand what is going wrong. I am trying to learn for future problems.
Also, would be great if someone can share any resource for python optimizations to avoid TLE
New user posting for the 1st time. Please let me know if I missed any information.