I wrote a very straight forward BFS code for SRM 646 Div2 Medium and It kept giving wrong answer on my laptop (case 2, Expected 1000 returning 999).
And I then changed my approach and used DFS with std::map. But it took ~26.3 seconds on my laptop to pass case 2. Having no clue what's going on, I ended up solving only the easiest problem.
However after the contest, I recalled similar incident happened on SRM645(the previous contest). I was getting wrong values while running my code locally on my laptop, but after the contest I coded the same Idea again and got it passed on both my laptop and TopCoder system test. This time I took a step further. I submitted my locally wrong code on TopCoder and wallah, it passed. This makes me both happy and sad at the same time.
Can you suggest what may going wrong? And please suggest your TopCoder Plugin.
This code gives Wa on my laptop but got ac on TopCoder.
I am using CodeBlocks 13.12 for than 6 months.
I use TopCoder AutoGen.exe for generating my code.
My Os is Windows 8.1 Pro