QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 1024 MB 満点: 100

#3767. Odd Matrix

統計

For an $n \times m$ matrix $A_{i, j}$, Bobo defines the distance between row $i$ and row $j$ as $d(i, j) = \sum_{k = 1}^m |A_{i, k} - A_{j, k}|$, where $|x|$ denotes the absolute value of $x$. Bobo calls the matrix $A_{i, j}$ an odd matrix if $d(i, j)$ is odd for all $1 \leq i < j \leq n$.

Given a matrix $A_{i, j}$, determine whether it is an odd matrix.

Input

The input contains multiple test cases. Process until the end of the file.

Each test case starts with a line containing two integers $n$ and $m$. The next $n$ lines each contain $m$ integers $A_{i, 1}, \dots, A_{i, m}$.

  • $1 \leq n, m \leq 10^3$
  • $0 \leq A_{i, j} < 10$
  • The sum of $n \times m$ does not exceed $2 \times 10^6$.

Output

For each test case, output Yes if it is an odd matrix, otherwise output No.

Examples

Input 1

1 2
0 0
2 3
1 2 3
2 1 4
3 3
1 2 3
4 5 6
7 8 9

Output 1

Yes
Yes
No

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.