QOJ.ac

QOJ

Límite de tiempo: 4 s Límite de memoria: 1024 MB Puntuación total: 10

#8412. Desant 3 [B]

Estadísticas

Byteotia is once again planning to attack Bitotia. The elite special unit "Bajtogrom" consists of $n$ soldiers who have lined up in a row for this morning's assembly. General Baltazar, responsible for carrying out the landing, has numbered their positions from left to right with numbers from $1$ to $n$.

Each soldier is either ready to carry out the landing or, due to a recent amendment to the regulations, requires additional training. General Baltazar would like all soldiers ready for the landing to form a contiguous segment of the row. More formally, he would like there to be no such triplet of soldier positions $1 \le i < j < k \le n$ that the $i$-th and $k$-th soldiers in the row are ready, while the $j$-th is not.

Since this condition may not be met by default, Baltazar will issue $m$ orders. In the $i$-th order, he will command the soldiers at positions $a_i$ and $b_i$ to communicate with each other to swap their positions. The soldiers will swap positions if and only if the $a_i$-th soldier is ready for the landing and the $b_i$-th soldier is not.

Baltazar has already chosen a sequence of orders and intends to issue them. However, he does not know how many soldiers are ready for the landing or which positions they occupy. For every integer $k$ between $1$ and $n$ inclusive, he would like to solve the following problem: consider all $\binom{n}{k}$ initial configurations of ready and unready soldiers, in which exactly $k$ soldiers are ready for the landing. For how many of these configurations will Baltazar's condition be met after all orders are executed (i.e., the soldiers ready for the landing will form a contiguous segment of the row)? Help him and calculate the values he is looking for!

Note: Since many beginner programmers participate in the Algorithmic Engagements, we decided not to overwhelm you with large numbers. It is sufficient to provide the remainder of the division of the number of possibilities by the prime number $2$ for each $k$.

Input

The first line of input contains two integers $n$ and $m$ ($2 \le n \le 35; 1 \le m \le 1\,000$), representing the number of soldiers in the row and the number of orders, respectively.

The next $m$ lines contain descriptions of the orders; the $i$-th of these lines contains two integers $a_i$ and $b_i$ ($1 \le a_i, b_i \le n; a_i \neq b_i$), as described in the problem statement.

Output

The first and only line of output should contain $n$ integers separated by single spaces; the $k$-th of these should be equal to the remainder of the division by $2$ of the number of initial configurations of soldiers in which exactly $k$ soldiers are ready for the landing and for which, after executing all orders, all ready soldiers form a contiguous segment of the row.

Examples

Input 1

4 4
4 1
1 2
3 4
1 4

Output 1

0 0 1 1

Note

If initially only one soldier is ready for the landing, they will certainly form a (single-element) contiguous segment of the row. However, there is no situation where two soldiers are ready for the landing and they end up occupying adjacent spots.

Consider the situation where everyone except the second soldier in the row is ready for the landing. The first order will not affect the positions of the soldiers. After the second order, because the first soldier in the row is ready and the second soldier in the row is not, they will swap places. The third order will again have no effect. Because now the first soldier in the row is not ready for the landing and the fourth soldier in the row is, they will not swap as a result of the last order. Finally, only the first soldier in the row will not be ready for the landing. This is the only initial configuration for $k = 3$ that ends up in accordance with Baltazar's intention.

For subsequent $k$, the numbers of possibilities are therefore equal to the sequence $[4, 0, 1, 1]$.

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.