KiAsaGibona's blog

By KiAsaGibona, 10 years ago, In English

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

  • Vote: I like it
  • +8
  • Vote: I do not like it

»
10 years ago, # |
  Vote: I like it +3 Vote: I do not like it

I read a similar story here as well: http://codeforces.net/blog/entry/15823

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes, I admire his confidence, however I think our cases are quite different. He tested only one case and that passed on his system, though he did not had time to check his solution against other test cases he kept going.

    In my case I had plenty of time (I had almost 1 hour) after I wrote my first solution. But my system mislead me. And I wasted a lot of time thinking wrong solutions, coding them and ending up even worse situations. :)

»
10 years ago, # |
  Vote: I like it +8 Vote: I do not like it

I'm not using AutoGen, so I have no idea why this might have happened. Maybe it caught a bug. Maybe the samples changed during the contest. Maybe you added these lines and forgot about them.