Codeforces Beta Round 41
B
未结束的国际象棋游戏
Game of chess unfinished
Codeforces
1700
原题
← AC →

未结束的国际象棋游戏AI (CI翻译)

Once Volodya was at the museum and saw a regular chessboard as a museum piece. And there were only four chess pieces on it: two white rooks, a white king and a black king. "Aha, blacks certainly didn't win!", — Volodya said and was right for sure. And your task is to say whether whites had won or not.

曾经,Volodya 在博物馆里看到一块作为展品的普通国际象棋棋盘。棋盘上只有四枚棋子:两辆白车、一枚白王和一枚黑王。“啊哈,黑方肯定没有获胜!”Volodya 说道,而且他当然说对了。你的任务是判断白方是否获胜。AI (CI翻译)

Pieces on the chessboard are guaranteed to represent a correct position (every piece occupies one cell, no two pieces occupy the same cell and kings cannot take each other). Thus, your task is only to decide whether whites mate blacks. We would remind you that it means that the black king can be taken by one of the opponent's pieces at the moment and also it cannot move to an unbeaten position. A rook moves vertically or horizontally by any number of free cells (assuming there are no other pieces on its path), a king — to the adjacent cells (either by corner or by side). Certainly, pieces cannot leave the board. The black king might be able to take opponent's rooks at his turn (see sample 3).

保证棋盘上的棋子构成一个合法局面(每枚棋子占据一个格子,没有两枚棋子占据同一个格子,并且两位国王不能互相攻击)。因此,你只需要判断白方是否将死黑方。将死意味着黑王当前正受到对方棋子的攻击,并且无法移动到一个不受攻击的位置。车可以沿竖直或水平方向移动任意个空格(假设路径上没有其他棋子),王可以移动到相邻的格子(包括斜向和横竖方向)。当然,棋子不能移出棋盘。黑王也可能在自己的回合吃掉对方的车(见样例 3)。AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input contains 4 space-separated piece positions: positions of the two rooks, the white king and the black king. Each position on $8 × 8$ chessboard is denoted by two symbols — ('a' - 'h') and ('1' - '8') — which stand for horizontal and vertical coordinates of the cell occupied by the piece. It is guaranteed, that no two pieces occupy the same cell, and kings cannot take each other.

输入包含 4 个以空格分隔的棋子位置:两辆车、白王和黑王的位置。$8 × 8$ 棋盘上的每个位置由两个符号表示:'a' 到 'h' 和 '1' 到 '8',分别表示该棋子所在格子的横坐标和纵坐标。保证没有两枚棋子占据同一个格子,并且两位国王不能互相攻击。AI (CI翻译)

Output

输出格式

AI (CI翻译)

Output should contain one word: "CHECKMATE" if whites mate blacks, and "OTHER" otherwise.

输出一个单词:如果白方将死黑方,输出 "CHECKMATE";否则输出 "OTHER"。AI (CI翻译)

样例

Input #1
a6 b4 c8 a8
Output #1
CHECKMATE
InputCopy OutputCopy
Input #2
a6 c4 b6 b8
Output #2
OTHER
InputCopy OutputCopy
Input #3
a2 b1 a3 a1
Output #3
OTHER
InputCopy OutputCopy
题目信息
题号
42B
时间限制
2 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。