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.