Mindsweepers 2015--IDCLOVE help

Here is the problem


and here is my solution http://www.codechef.com/viewsolution/6147834

I got a correct answer for this one but I want to ask if there is another way of solving this kind of problem. If there is an editorial for this problem, can you send me the link? Thanks :slight_smile:

Editorial link here.