Bling Bling Bling
Time Limit : 1 Second
Memory Limit : 512 MB
Submission: 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