Universal Cup Judging System

Universal Cup

実行時間制限: 1.0 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓
統計

크기가 $n \times m$인 이진 행렬 $A$가 주어집니다. 기본적으로 이는 $n$개의 행과 $m$개의 열로 이루어진 표이며, 각 칸의 값은 $0$ 또는 $1$입니다.

한 번의 이동에서 이 행렬의 한 칸 $(i, j)$를 선택하여 그 칸과 그 칸과 변을 공유하는 모든 칸의 값을 뒤집을 수 있습니다. 엄밀하게는 $|s - i| + |t - j| \le 1$을 만족하는 모든 칸 $(s, t)$ ($1 \le s \le n, 1 \le t \le m$)에 대해 변환 $A_{s,t} \leftarrow 1 - A_{s,t}$가 적용됩니다.

행렬의 모든 원소를 영으로 만드는 방법을 찾거나, 그것이 불가능함을 판별하세요.

입력

첫 번째 줄에는 행렬의 크기를 나타내는 두 정수 $n$과 $m$ ($1 \le n, m \le 500$)이 주어집니다.

이어지는 $n$개의 줄 중 $i$번째 줄에는 행렬의 $i$번째 행에 해당하는 $m$자리 이진 문자열이 주어집니다.

출력

해가 없다면 한 줄에 단어 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.