-->
当前位置:首页 > 题库

PROGRAMMING:Interesting queue

Luz5年前 (2021-05-10)题库521
This problem redefines the operation of the queue out: the number of the first out of the team re enters the team at the end of the team.
For example, if there are three numbers of '1, 2, 3' in the queue, and the team is required to leave the team for the first time, then '1' will leave the team for the first time, and '1' will enter the team from the end of the team, and the queue will become '2, 3, 1'.
The order of joining the team is 1,2,3,4... N. at the same time, a binary string is given. 1 represents the operation of leaving the team and 0 represents the operation of joining the team.
###Input format:
In the first line, there are two numbers n, m (n < = 100, n < m), where n is the number of numbers in the queue, and M is the number of operands
Next, m lines, each with a number, 1 or 0, represent different operations
###Output format:
After the output operation, each number of the queue is separated by a space, and there is no space after the last number
###Input example:
```in
5 8
0
0
one
0
one
0
one
0
```
###Output example:
```out
3 2 4 1 5
```







answer:If there is no answer, please comment