Try corrected test case
# . .
. . #
Try corrected test case
# . .
. . #
Have you considered variations on this case:
........
........
...#....
.....#..
....#...
........
........
I am getting TLE , but my solution is O(n*m) . Please suggest.
https://www.codechef.com/viewsolution/40482358