#P4405. [ZJOI2009] 硬币游戏
[ZJOI2009] 硬币游戏
Description
Orez likes playing games, and he recently invented a coin game. He divides the edge of a table into positions and labels them clockwise as , then places coins on the positions with odd labels.
Each operation is as follows: place one coin between any two coins, and then remove those two original coins. The side of the newly placed coin is determined by the two coins on its sides. If both coins are heads up or both are tails up, the new coin is heads up; otherwise, it is tails up. After performing the operation times, what will the configuration of coins along the edge of the table be.
Input Format
The first line contains two integers and .
The next line contains integers, describing the initial arrangement of coins along the edge. The -th integer gives the state of the coin placed at position , where means heads up and means tails up.
Output Format
Output a single line with integers. The -th integer is the state at position along the edge of the table, where means heads up, means tails up, and means there is no coin.
10 5
2 2 2 1 1 1 1 1 1 2
0 1 0 1 0 1 0 1 0 2 0 1 0 2 0 1 0 1 0 1
Hint
30% of the testdata: , .
100% of the testdata: , .
Sample explanation.
20202010101010101020
01010201010101010201
10102020101010102020
01020102010101020102
20202020201010202020
01010101020102010101
Translated by ChatGPT 5
京公网安备 11011102002149号