Optimal game strategy getting cmpile error while using unordered map


this is my code it passed while using map but when i am using the unordered map then it bis giving compilation error why??

Are you facing the same error on the hackerblocks ide as well ?

yess in geeks ide also …

This is realy strange. I see that you can use unordered_map<int,int> in this but when I use unordered_map< pair< int,int>, int > then it is giving a compiltation error. Can you write it to [email protected] regarding this.

but it is not only of cb ide it is showing same for geeks ide and all ide?? why it is so??

Many online ides were created before c++17 or c++14 was launced so they somtimes use c++5 as their compiler and which causes these problems. So dont worry you can use it in major sites like codechef and codeforces. But for now you will have to work with maps.

By map my complexity will be n^2×logn

The time complexity in unordered_map is sometimes more than map. It has a worst case time complexity of 0(n) so You cannot be sure that it will definaltely reduce your time complexity.

But in that we are not sure but in map we are sure that it will take logn so what to do…

You can use map as it will not give a tle with N upto 5*10^5.

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.