QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 1024 MB

#23968. 圈与叉

İstatistikler

有一个 $N$ 行 $N$ 列的方格表,将从上往下第 $i$ 行 ($1 \le i \le N$)、从左往右第 $j$ 列 ($1 \le j \le N$) 的格子记作格子 $(i, j)$。格子 $(i, j)$ 中写有字符 $C_{i,j}$。这里 $C_{i,j}$ 是 o 或 x。

如果存在“整行均为相同字符的行”或“整列均为相同字符的列”,则输出 Yes,否则输出 No。

约束条件

  • $1 \le N \le 100$。
  • $C_{i,j}$ 是 o 或 x 之一 ($1 \le i \le N$, $1 \le j \le N$)。
  • $N$ 是整数。

输入格式

输入按以下格式给出:

N
C_{1,1} C_{1,2} ... C_{1,N}
C_{2,1} C_{2,2} ... C_{2,N}
...
C_{N,1} C_{N,2} ... C_{N,N}

输出格式

如果存在“整行均为相同字符的行”或“整列均为相同字符的列”,则输出 Yes,否则输出 No。

除答案外不要输出任何内容。(也不要输出提示输入的文字等。)

样例

样例输入 1

3
o x x
o o x
o x o

样例输出 1

Yes

样例解释 1

$C_{1,1} =$ o,$C_{2,1} =$ o,$C_{3,1} =$ o,第 $1$ 列的字符全部为 o。因此输出 Yes。

样例输入 2

4
o x x x
x o x x
x x o x
x x x o

样例输出 2

No

样例解释 2

  • 不存在整行均为相同字符的行。
  • 不存在整列均为相同字符的列。

因此输出 No。

样例输入 3

6
x x o o x x
x o x x o x
o x x x x o
o x x x x o
x o x x o x
x x o o x x

样例输出 3

No

样例解释 3

  • 不存在整行均为相同字符的行。
  • 不存在整列均为相同字符的列。

因此输出 No。

样例输入 4

10
o x o o o x o x o x
o o x o o x o o o x
x o o x o o o x x x
o o o x o o x o x x
o o o o o o o x o x
x x x x x x x x x x
o o o x o o o o o x
o o o x o o o o o x
o o o x o o x x o x
o x o o o o x o o x

样例输出 4

Yes

样例解释 4

第 $10$ 列和第 $6$ 行各自全部由相同字符组成,因此输出 Yes。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.