B. Turn all the lights on! I——特辣的海藻! I

    传统题 1000ms 256MiB

Turn all the lights on! I——特辣的海藻! I

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Statement

There are nn lanterns arranged in a circle. Initially, these lanterns are all closed.

There are nn buttons on the console. Pressing the xxth button will reverse the state of lantern xx and the two adjacent lanterns. "Reverse" means turning off to on, and turning on to off.

For example, if you press the 55th button, lanterns 44, 55, and 66 will all flip. If you press the nnth button, the states of lanterns n1,nn-1, n and 11 will flip. This is because the lanterns are arranged in a ring, with n1n-1 and 11 being adjacent to nn.

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, nn and mm,(3n,m105)(3\leq n,m\leq 10^5), representing the total number of lanterns, nn, and the number of times we pressed the button, mm.

The next mm lines each contain a positive integer, indicating which button we pressed during each operation.

Output

A single line of nn integers, separated by spaces, representing the states of nn lanterns. 00 represents a lantern off, and 11 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