QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 1024 MB

#23968. Xs and Os

Estadísticas

問題文

N 行 N 列のマス目があり,このマス目の上から i 行目 (1≦i≦N) ,左から j 列目 (1≦j≦N) のマスをマス (i,j) と表記する.マス (i,j) には文字 Ci,j が書き込まれている.ここで Ci,j は o または x である.

「全体が同じ文字で揃っている行」または「全体が同じ文字で揃っている列」が存在するならば Yes を,そうでないならば No を出力せよ.

制約

  • 1 ≦ N ≦ 100.
  • Ci,j は o か x のいずれかである (1≦i≦N,1≦j≦N).
  • N は整数である.

入力

入力は以下の形式で与えられる.

N
C1,1 C1,2 … C1,N
C2,1 C2,2 … C2,N
︙
CN,1 CN,2 … CN,N

出力

「全体が同じ文字で揃っている行」または「全体が同じ文字で揃っている列」が存在するならば Yes を,そうでないならば No を出力せよ.

答え以外は何も出力しないこと.(入力を促す文章なども出力しないこと.)

解答形式については,練習問題やその解答例 を参考にしても良い.


入力例 1

3
o   x   x
o   o   x
o   x   o

出力例 1

Yes

C1,1= o,C2,1= o,C3,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
  • 全体が同じ文字で揃っている行は存在しない.
  • 全体が同じ文字で揃っている列は存在しない.

したがって 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
  • 全体が同じ文字で揃っている行は存在しない.
  • 全体が同じ文字で揃っている列は存在しない.

したがって 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

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.