TOURMAP solution giving WA,pls help!

I tried coding the solution of the problem using hashmaps and vectors(not using graph),can someone pls point out the error in my code? Here is my code:


I also solved the problem using maps:

Check the above link for my submission and compare it with your own implementation… :slight_smile:

Check corner cases (N=1) and take care of repeated cities on different “sets”…

Good luck,


Hi @kuruma
thanks for your reply. I did the requisite change for n=1 and found that in your code too repeated cities has not been dealt with,still getting WA. please provide some test case where i might be going wrong, my modified code: