#K8496. Rosa's Knight Navigation
Rosa's Knight Navigation
Rosa's Knight Navigation
Rosa's Knight Navigation Challenge:
Rosa is attempting to move a knight from the top-left corner (cell (1,1)) of an n×n chessboard to the bottom-right corner (cell (n,n)). However, Charley has blocked some cells on the board. The knight moves in the standard "L-shape" (two steps in one direction and one step perpendicular to that direction). Your task is to determine if there exists a valid sequence of knight moves from (1,1) to (n,n) that does not pass through any blocked cells. If such a path exists, output Rosa
, otherwise output Charley
.
Note: If the starting or ending cell is blocked, the answer will be Charley
.
The knight's move offsets are given by:
\[ \{(-2, -1), (-1, -2), (1, -2), (2, -1), (2, 1), (1, 2), (-1, 2), (-2, 1)\} \]inputFormat
The first line contains two integers n and m, where n is the size of the chessboard (n x n) and m is the number of blocked cells.
The following m lines each contain two integers x and y representing the coordinates of a blocked cell.
All input is read from standard input.
outputFormat
Output a single line with either Rosa
if a valid path exists or Charley
otherwise. The result should be printed to standard output.
5 0
Rosa
</p>