A12230 | The King's Race
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
On a chessboard with a width of $n$ and a height of $n$ , rows are numbered from bottom to top from $1$ to $n$ , columns are numbered from left to right from $1$ to $n$ . Therefore, for each cell of the chessboard, you can assign the coordinates $(r,c)$ , where $r$ is the number of the row, and $c$ is the number of the column.
The white king has been sitting in a cell with $(1,1)$ coordinates for a thousand years, while the black king has been sitting in a cell with $(n,n)$ coordinates. They would have sat like that further, but suddenly a beautiful coin fell on the cell with coordinates $(x,y)$ ...
Each of the monarchs wanted to get it, so they decided to arrange a race according to slightly changed chess rules:
As in chess, the white king makes the first move, the black king makes the second one, the white king makes the third one, and so on. However, in this problem, kings can stand in adjacent cells or even in the same cell at the same time.
The player who reaches the coin first will win, that is to say, the player who reaches the cell with the coordinates $(x,y)$ first will win.
Let's recall that the king is such a chess piece that can move one cell in all directions, that is, if the king is in the $(a,b)$ cell, then in one move he can move from $(a,b)$ to the cells $(a + 1,b)$ , $(a - 1,b)$ , $(a,b + 1)$ , $(a,b - 1)$ , $(a + 1,b - 1)$ , $(a + 1,b + 1)$ , $(a - 1,b - 1)$ , or $(a - 1,b + 1)$ . Going outside of the field is prohibited.
Determine the color of the king, who will reach the cell with the coordinates $(x,y)$ first, if the white king moves first.
The white king has been sitting in a cell with $(1,1)$ coordinates for a thousand years, while the black king has been sitting in a cell with $(n,n)$ coordinates. They would have sat like that further, but suddenly a beautiful coin fell on the cell with coordinates $(x,y)$ ...
Each of the monarchs wanted to get it, so they decided to arrange a race according to slightly changed chess rules:
As in chess, the white king makes the first move, the black king makes the second one, the white king makes the third one, and so on. However, in this problem, kings can stand in adjacent cells or even in the same cell at the same time.
The player who reaches the coin first will win, that is to say, the player who reaches the cell with the coordinates $(x,y)$ first will win.
Let's recall that the king is such a chess piece that can move one cell in all directions, that is, if the king is in the $(a,b)$ cell, then in one move he can move from $(a,b)$ to the cells $(a + 1,b)$ , $(a - 1,b)$ , $(a,b + 1)$ , $(a,b - 1)$ , $(a + 1,b - 1)$ , $(a + 1,b + 1)$ , $(a - 1,b - 1)$ , or $(a - 1,b + 1)$ . Going outside of the field is prohibited.
Determine the color of the king, who will reach the cell with the coordinates $(x,y)$ first, if the white king moves first.
输入格式
The first line contains a single integer $n$ ( $2 \le n \le 10^{18}$ ) — the length of the side of the chess field.
The second line contains two integers $x$ and $y$ ( $1 \le x,y \le n$ ) — coordinates of the cell, where the coin fell.
The second line contains two integers $x$ and $y$ ( $1 \le x,y \le n$ ) — coordinates of the cell, where the coin fell.
输出格式
In a single line print the answer "White" (without quotes), if the white king will win, or "Black" (without quotes), if the black king will win.
You can print each letter in any case (upper or lower).
You can print each letter in any case (upper or lower).
输入输出样例
输入 #1
4 2 3
输出 #1
White
输入 #2
5 3 5
输出 #2
Black
输入 #3
2 2 2
输出 #3
Black
An example of the race from the first sample where both the white king and the black king move optimally:
1. The white king moves from the cell $(1,1)$ into the cell $(2,2)$ .
2. The black king moves form the cell $(4,4)$ into the cell $(3,3)$ .
3. The white king moves from the cell $(2,2)$ into the cell $(2,3)$ . This is cell containing the coin, so the white king wins.
An example of the race from the second sample where both the white king and the black king move optimally:
1. The white king moves from the cell $(1,1)$ into the cell $(2,2)$ .
2. The black king moves form the cell $(5,5)$ into the cell $(4,4)$ .
3. The white king moves from the cell $(2,2)$ into the cell $(3,3)$ .
4. The black king moves from the cell $(4,4)$ into the cell $(3,5)$ . This is the cell, where the coin fell, so the black king wins.
In the third example, the coin fell in the starting cell of the black king, so the black king immediately wins.

1. The white king moves from the cell $(1,1)$ into the cell $(2,2)$ .
2. The black king moves form the cell $(4,4)$ into the cell $(3,3)$ .
3. The white king moves from the cell $(2,2)$ into the cell $(2,3)$ . This is cell containing the coin, so the white king wins.
An example of the race from the second sample where both the white king and the black king move optimally:
1. The white king moves from the cell $(1,1)$ into the cell $(2,2)$ .
2. The black king moves form the cell $(5,5)$ into the cell $(4,4)$ .
3. The white king moves from the cell $(2,2)$ into the cell $(3,3)$ .
4. The black king moves from the cell $(4,4)$ into the cell $(3,5)$ . This is the cell, where the coin fell, so the black king wins.
In the third example, the coin fell in the starting cell of the black king, so the black king immediately wins.

C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted