問題一覧 > 通常問題

No.1941 CHECKER×CHECKER(1)

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 290
作問者 : H20 / テスター : 蜜蜂 naskya
お気に入りにしたユーザー ProblemId : 7741 / 自分の提出
問題文最終更新日: 2022-05-05 15:26:29
CHECKER×CHECKER(1)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
yukicoder contest 344 (順位表) の他の問題:

Problem Statement

There is a grid with $3$ rows and $3$ columns. The cell at the $i$-th row from the top and the $j$-th column from the left is called cell $(i,j)$.

Each cell is colored either black or white.

The color information of the cells is given as strings $S_1$, $S_2$, $S_3$ in the following format.

  • If the $j$-th character of the string $S_i$ is #, cell $(i,j)$ is black.
  • If the $j$-th character of the string $S_i$ is ., cell $(i,j)$ is white.

The grid is said to be a checkered pattern if, for every cell, the cells adjacent to it by an edge have a color different from that of the cell itself.

Determine whether the given grid is a checkered pattern.

Input

The input is given from standard input in the following format.
$S_1$
$S_2$
$S_3$

Constraints

$S_1$, $S_2$, $S_3$ are strings of $3$ characters consisting of # or .

Output

Print Yes if the grid is a checkered pattern, and No otherwise.

Sample

Sample 1
Input
#.#
.#.
#.#
Output
Yes

For every cell, the cells adjacent to it by an edge have a color different from that of the cell itself, so the answer is Yes.

Sample 2
Input
###
#.#
###
Output
No

For the center cell, the cells adjacent to it by an edge have a color different from that of the cell itself.

However, the other cells do not satisfy the condition, so the answer is No.

Sample 3
Input
#.#
#.#
.#.
Output
No

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。