Dear all, I am stuck with solving https://www.spoj.com/problems/PUCMM223/ . I have implemented the obvious BFS approach, however for some reason it gives wrong answer on sample input. Can you please suggest what might be the problem? My code is here: https://ideone.com/b9m0io
I think this test is intended to stop the pieces from crossing each other, but it also stops a piece from moving to where the other piece was.