i am trying to solve http://www.spoj.pl/problems/BITMAP/ problem.
my code executes fine in my computer but its giving wrong answer while running on SPOJ .
i can not make out for which testcase it is failing.
i approached in this procedure: first i got all the positions of 1's in the graph. then i searched from these points by a dfs in the array to update the ans array,
my code is http://ideone.com/2p8VC
thanks
You missed "nx" and "ny" arrays size. It is not 185. In worst case it is 185*185 (imagine a grid 185 x 185 where all cells are white!)
So, you fail at testcases having more than 185 white cells !