Turn all the lights on! I——特辣的海藻! I
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Statement
There are lanterns arranged in a circle. Initially, these lanterns are all closed.
There are buttons on the console. Pressing the th button will reverse the state of lantern and the two adjacent lanterns. "Reverse" means turning off to on, and turning on to off.
For example, if you press the th button, lanterns , , and will all flip. If you press the th button, the states of lanterns and will flip. This is because the lanterns are arranged in a ring, with and being adjacent to .
We pressed some buttons one by one. You need to program to find the final state of the lanterns after our operation is completed.
Input
The first line contains two positive integers, and ,, representing the total number of lanterns, , and the number of times we pressed the button, .
The next lines each contain a positive integer, indicating which button we pressed during each operation.
Output
A single line of integers, separated by spaces, representing the states of lanterns. represents a lantern off, and represents a lantern on.
Samples
5 4
1 3 1 2
1 0 0 1 0
The status of the lantern sequence is as follows:

The final state of the lantern when pressing 2 is

So you should output 1 0 0 1 0
2025 JSUT Collegiate Programming Contest 江苏理工学院新生赛-同步赛
- 状态
- 已结束
- 规则
- ACM/ICPC
- 题目
- 15
- 开始于
- 2025-11-8 12:00
- 结束于
- 2025-11-8 17:00
- 持续时间
- 5 小时
- 主持人
- 参赛人数
- 15