Why TLE ? in the test cases other than 1st
@codingblockscpp
the way you are trying to sort the unordered map it is not possible, c++ implementation of sort does not allow that.
There is another way around of doing that, what you can do is store all the values present in unordered map into a vector.
Then you can easily sort the vector.
For better understanding i have done the required changes in your code have a look https://ide.codingblocks.com/s/249855
Also please mark this doubt as resolved after solving this problem.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.