#P2203. [USACO13OPEN] Blink B
[USACO13OPEN] Blink B
Description
Farmer John is unhappy with the dim lighting on the farm, so he has just installed a beautifully decorated new chandelier. This chandelier consists of lamps arranged in a circle.
The cows are fascinated by this new light device. They like to play the following game: at time , for each lamp , if at time the lamp to its left (if then ; if , then ) is on, then toggle the state of lamp ; otherwise, do nothing.
They will keep performing this operation for units of time. Please note that may exceed the range of a typical 32-bit integer.
Given the initial state of each lamp, compute the state of each lamp after units of time.
Input Format
Line 1: Two integers and .
Lines : Line describes the initial state of lamp , represented by 0 (off) or 1 (on).
Output Format
lines. On line , output a single integer representing the final state of lamp , using 0 (off) or 1 (on).
5 6
1
0
0
0
0
1
1
1
0
1
Hint
Sample Explanation
Below is a simulation of the sample output:
Time T=0: 1 0 0 0 0
Time T=1: 1 1 0 0 0
Time T=2: 1 0 1 0 0
Time T=3: 1 1 1 1 0
Time T=4: 1 0 0 0 1
Time T=5: 0 1 0 0 1
Time T=6: 1 1 1 0 1
Translated by ChatGPT 5
京公网安备 11011102002149号