QOJ.ac

QOJ

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

#23968. X และ O

İ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.