QOJ.ac

QOJ

Time Limit: 1.75 s Memory Limit: 1024 MB Total points: 100

#428. Equation Mod 2

الإحصائيات

You are given a matrix $A_{m \times (n+1)}$. You need to find $n$ integers $x_1,x_2,\cdots,x_n$ that satisfy the following conditions.

  • For each $1 \leq i \leq n$, $x_i \in \{ 0, 1 \}$
  • For each $1 \leq i \leq m$, $\sum_{j=1}^n A_{i,j} \cdot x_j \equiv A_{i,n+1} \pmod 2$

If there are multiple possible solutions, output any of them.

Input

The first line contains two integers $n$ and $m$ ($1 \leq n,m \leq 5 \times 10^3$).

The next $m$ lines describes the matrix $A$:

  • The $i$-th line of these lines contains $n+1$ numbers $A_{i,1}, A_{i,2}, \cdots, A_{i,n}, A_{i,n+1}$

Output

Output a single line contains $n$ integers $x_1,x_2,\cdots, x_n$. It is guaranteed that there's at least one valid solution.

Examples

Input 1

3 3
0 0 1 1
1 0 1 0
1 1 1 1

Output 1

1 1 1

Discussions

About Discussions

The discussion section is only for posting: Editorials, 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. Submitting multiple issues may cause your account to be banned.
  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.