PUPPYCT WA, please help finding the error

,

Hi! This is the link to my solution for the problem PUPPYCT from LTIME26. I know that my code is a simple search which is not going to pass bigger test cases because of the big size of visited array and time limit, my question is that why does it show WA even for small test cases. Please help finding the bug.

Hi, I also had the same concept. But I think problem is with your counting function (variable c). It overlooks the overlapping case.(especially when x,y are taken as input and the same x,y are a part of diagonal from other input of x,y)

You can have a look at my solution. https://www.codechef.com/viewsolution/7558056

Just to get 23 points more and speeding the solution a bit, view this solution of mine. https://www.codechef.com/viewsolution/7559253

Hope this helps.