Getting WA in codeforces #325 div1 B

Problem Info

B:philip and trains:Problem - B - Codeforces

My Work

submission link:Submission #129740756 - Codeforces

my approach: I used bfs approach and went into the reference frame of trains so instead of moving trains to left by 2 units i move philips by 2 units right.But i get wrong answer on test case 4. I know how to stress test,but I don’t know how I would be generating test cases here.Can someone please tell where am I going wrong?

1 Like