CF42B.Game of chess unfinished

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

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)。

输入格式

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'),分别代表该棋子所在格子的横向坐标和纵向坐标。保证没有两个棋子占据同一格子,且双方王彼此不能直接吃掉对方。

输出格式

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

输出应为一个单词:若白方将死黑方,则输出“CHECKMATE”;否则输出“OTHER”。

输入输出样例

  • 输入#1

    a6 b4 c8 a8

    输出#1

    CHECKMATE
  • 输入#2

    a6 c4 b6 b8

    输出#2

    OTHER
  • 输入#3

    a2 b1 a3 a1

    输出#3

    OTHER

输入解题思路,AI测评打分。不知道怎么写?

首页