1478. Lamps

单点时限: 2.0 sec

内存限制: 256 MB

There is a castle with a circular main hall. There are N lamps numbered from 1 to N on the wall of the hall. Each of the lamps can be either on or off. At each second the lamp number i changes its state if the lamp number i+1 is on, except the lamp number N changes its state if the lamp number 1 is on.

Your task is, given the initial states of all lamps at some moment, to find their states after M seconds.

输入格式

The first line of the input contains two integers N (0 < N ≤ 106) and M (0 ≤ M ≤ 109). The next N lines contain the initial states of the lamps, starting with the lamp number 1. A line containing 0 means that the lamp is off and 1 means that the lamp is on.

输出格式

The output must contain exactly N lines describing the states of the lamps after M seconds, starting with the lamp number 1.

样例

Input
3 1
0
0
1
Output
0
1
1

0 人解决,3 人已尝试。

0 份提交通过,共有 9 份提交。

9.9 EMB 奖励。

创建: 16 年,9 月前.

修改: 6 年,8 月前.

最后提交: 10 月,1 周前.

来源: BOI 2003

题目标签