Could somebody tell me where does my solution go wrong?

Working for all the test cases in the editorial.

What I had done was to remove that column of demons which removes the maximum number of rows and vice versa

and if I’m not able to find such a row or column I remove that row or column which has the maximum number of demons.

http://www.codechef.com/viewsolution/2842259

Also could somebody give me the test case where my second approach fails:

1)Find the minimum(current number of rows,current number of columns).Let it be x

2)Find the row/column with maximum number of demons and remove that.(break ties arbitrarily)

Let the answer using 2) be y.

The final answer is min(x,y)