Wa spoj 206. Bitmap again and again

Question link:: SPOJ.com - Problem BITMAP

I have been trying again and again but still it is resulting wa
I know how to solve this question using bfs by passing all the ones in a queue…
but i want to know what is wrong in the above stated code using dfs and dp

see this…mePHWP - Online C++ Compiler & Debugging Tool - Ideone.com i changed ur dx and dy array…u cnnot traverse diagonally…hope this helps…:slight_smile: