#P3937. Changing
Changing
Description
There are lamps arranged in a circle, labeled clockwise as . The initial time is . At the initial time, the on/off state of the -th lamp is given, where means off and means on. At the next time, each lamp’s state depends on the current state of this lamp and the next lamp in the clockwise direction. If the two lamps have the same state, then at the next time this lamp is off; otherwise, it is on.
Find the state of the -th lamp at time .
Input Format
The first line contains three integers , , .
The second line contains integers, each being or , representing .
Output Format
Output one line with a single number, or , representing the state of the -th lamp at time .
4 2 1
1 0 1 0
0
Hint
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号