QOJ.ac

QOJ

时间限制: 1 s 内存限制: 256 MB 总分: 100

#13291. Coin Game

统计

Orez loves playing games, and he recently invented a coin game. He marks $2n$ positions on the edge of a table and labels them clockwise as $1, 2, \dots, 2n$, then places $n$ coins at the odd-numbered positions. The game proceeds in steps: in each step, a new coin is placed between every two existing coins, and then the original coins are removed. The side (heads or tails) of the newly placed coin is determined by the two coins it is placed between: if both coins are heads up or both are tails up, the new coin is heads up; otherwise, it is tails up.

What will be the state of the coins on the edge of the table after $T$ operations?

Input

The first line contains two integers $n$ and $T$.

The next line contains $n$ integers, representing the initial placement of the coins on the edge of the table. The $i$-th integer $a_i$ represents the coin placed at position $2i-1$, where $a_i=1$ means heads up and $a_i=2$ means tails up.

Output

The output contains a single line with $2n$ integers, where the $i$-th integer $b_i$ represents the state of the coin at position $i$ on the edge of the table. $b_i=1$ means heads up, $b_i=2$ means tails up, and $b_i=0$ means there is no coin.

Examples

Input 1

10 5
2 2 2 1 1 1 1 1 1 2

Output 1

0 1 0 1 0 1 0 1 0 2 0 1 0 2 0 1 0 1 0 1

Constraints

For 30% of the data: $n \le 1000, T \le 1000$

For 100% of the data: $n \le 100000, T \le 2^{60}$

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.