Company: Gameberry labs
Difficulty: medium
Safe King on Chessboard Given an N×N chessboard, with K queens and one king on it. You may move the king at most once. You cannot capture any piece with the king. You need to tell whether you can move the king on such a square, such that it is safe from all the queens, that will attack the king after this move. This means that no queen should capture the king after the move of the king. Formally, if the initial position of the king is (x 1 , y 1 ) and the position of the king after 1 move is (x 2 , y 2 ), then |x 1 - x 2 | ≤ 1 and |y 1 - y 2 | ≤ 1, where |a| denotes modulus of a. Note: You may also decide not to move the king. And if you decide to move the king, you should ensure that it does not go out of the board. Note: You cannot capture any piece with the king. Reminder – The king can move at any cell, that is adjacent to the current cell, in all eight directions. Input Format The first line contains integers \'N\' (side length of the chessboard). The rows are numbered from \'1\'