HUST 2016招新选拔

From: 2016-03-06 14:00:00 To: 2016-03-06 17:30:00 Now: 2017-09-24 21:46:55 Status: Public

B - Bling Bling Bling

Time Limit: 1s Memory Limit: 512MB

Submissions: 100 Solved: 14
Description

    Farmer John installed N lights bulbs which are arranged in a circle.

    At time T, Bessie toggle the state of each light bulb if its neighbor to the left was turned on at time T-1. She plays the game for M units of time.

    Given the initial states of the light bulbs, output their final states after M units of time.

Input

Line 1: N and M, 3<=N<=16, 1<=M<=10^15

Line 2..N+1:the initial state of bulb i, either 0(off) or 1(on)

Output

N lines, their final states after M units of time.

Sample Input
5 6
1
0
0
0
0
Sample Output
1
1
1
0
1
Hint

T=0: 1 0 0 0 0

T=1: 1 1 0 0 0

T=2: 1 0 1 0 0

T=3: 1 1 1 1 0

T=4: 1 0 0 0 1

T=5: 0 1 0 0 1

T=6: 1 1 1 0 1

Source