Universal Cup Judging System

Universal Cup

Time Limit: 1.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓
Statistics

คุณได้รับเมทริกซ์ฐานสอง $A$ ขนาด $n \times m$ โดยพื้นฐานแล้วมันคือตารางที่มี $n$ แถวและ $m$ คอลัมน์ ซึ่งแต่ละช่องมีค่าเป็น $0$ หรือ $1$

ในการดำเนินการหนึ่งครั้ง คุณสามารถเลือกช่อง $(i, j)$ ของเมทริกซ์นี้ แล้วพลิกค่าในช่องนั้นรวมถึงทุกช่องที่มีด้านร่วมกับมัน กล่าวอย่างเป็นทางการคือ สำหรับทุกช่อง $(s, t)$ ($1 \le s \le n, 1 \le t \le m$) ที่ทำให้ $|s - i| + |t - j| \le 1$ จะถูกแปลงค่าด้วย $A_{s,t} \leftarrow 1 - A_{s,t}$

จงหาวิธีทำให้เมทริกซ์มีเฉพาะสมาชิกที่เป็นศูนย์ หรือระบุว่าเป็นไปไม่ได้

ข้อมูลนำเข้า

บรรทัดแรกประกอบด้วยจำนวนเต็มสองจำนวนคือ $n$ และ $m$ ($1 \le n, m \le 500$) ซึ่งแทนขนาดของเมทริกซ์

บรรทัดที่ $i$ จาก $n$ บรรทัดถัดไปประกอบด้วยสตริงฐานสองความยาว $m$ ตัวเลข ซึ่งตรงกับแถวที่ $i$ ของเมทริกซ์

ข้อมูลส่งออก

หากไม่มีคำตอบ ให้พิมพ์คำว่า NO ในบรรทัดเดียว

มิฉะนั้น ให้พิมพ์คำว่า YES ในบรรทัดแรก ในแต่ละบรรทัดของอีก $n$ บรรทัดถัดไป ให้พิมพ์สตริงฐานสองที่มีความยาว $m$ สตริงเหล่านี้จะประกอบกันเป็นเมทริกซ์ขนาด $n \times m$ โดยแต่ละสมาชิกจะต้องมีค่าเท่ากับ $1$ ก็ต่อเมื่อคุณตั้งใจจะดำเนินการที่ช่องนั้น

แน่นอนว่าผลรวมของการดำเนินการทั้งหมดที่เลือกจะต้องเปลี่ยนเมทริกซ์เริ่มต้นให้กลายเป็นเมทริกซ์ที่มีแต่ศูนย์เท่านั้น

หากมีคำตอบหลายแบบ ให้พิมพ์แบบใดก็ได้

คุณสามารถแสดงคำตอบเป็นตัวพิมพ์ใหญ่หรือตัวพิมพ์เล็กก็ได้

ตัวอย่าง

ข้อมูลนำเข้าตัวอย่าง 1

3 4
1000
0001
0100

ข้อมูลส่งออกตัวอย่าง 1

YES
0100
0110
1100

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.