QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 1024 MB

#23968. 圈與叉

الإحصائيات

有一個 $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.