Problemm with the code

could you figure out the problem in my code

@sshreya2912,
Line 49, you aren’t making sure, x,y don’t go out of bound of array.

Hey, thanks but I am getting a tle for the last one

https://ide.codingblocks.com/s/293026 is the code(corrected)

@sshreya2912,
Your code is fine, but the problem has large constraints wrt to your logic. You would probably need to speed up your code via some heuristics. You can see this and try again.

That helped but https://ide.codingblocks.com/s/293200 I still am getting a tle for 3rd case(bitset wala code)

@sshreya2912,
Your code seems right, there is something wrong with the 3rd test case itself, it will be updated as soon as possible.