So, idk… Tried all possible test cases (I think…) but WA.
my code:
http://pastebin.com/6D6KGp7a
this is a problem:
So, idk… Tried all possible test cases (I think…) but WA.
my code:
http://pastebin.com/6D6KGp7a
this is a problem:
While checking that you are not out of the board, you have compared the final positions (i+1, j+2, etc), but instead i and j must have been compared. The knight (at (i,j)) must be within the board.
EDIT : Real find in the comments, problem with global memory
It seems like there is no need to check if the coordinates are out of board as 0<=i,j<N.
I don’t get it ;|
Oh! Sorry, I don’t know what I was thinking!
Though I found the error. The vector Coord is global, and you are not clearing it for each testcase. Writing Coord.clear()
after each case got AC http://www.codechef.com/viewsolution/3796377
Ah, that’s a mistake alright… ;/