process.stdin.resume(); process.stdin.setEncoding('ascii'); var input_stdin = ""; var input_stdin_array = ""; var input_currentline = 0; process.stdin.on('data', function (data) { input_stdin += data; }); process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); }); function readLine() { return input_stdin_array[input_currentline++]; } /////////////// ignore above this line //////////////////// function main() { var n = parseInt(readLine()); // your code goes here var a=createEmptyBoard(n-1); for(var i=0;i0){ var c=q.shift(); var validMoves=findValidMoves(c,n,i,j); for(var k=0;k-1){ r.push({x:c.x+i,y:c.y-j}) } if(c.x-i>-1&&c.y+j-1&&c.y-j>-1){ r.push({x:c.x-i,y:c.y-j}) } if(c.x+j-1){ r.push({x:c.x+j,y:c.y-i}) } if(c.x-j>-1&&c.y+i-1&&c.y-i>-1){ r.push({x:c.x-j,y:c.y-i}) } return r; }