CF641C.Little Artem and Dance

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Little Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together.

More detailed, there are nn pairs of boys and girls standing in a circle. Initially, boy number 11 dances with a girl number 11 , boy number 22 dances with a girl number 22 and so on. Girls are numbered in the clockwise order. During the dance different moves are announced and all pairs perform this moves. While performing moves boys move along the circle, while girls always stay at their initial position. For the purpose of this problem we consider two different types of moves:

  1. Value xx and some direction are announced, and all boys move xx positions in the corresponding direction.
  2. Boys dancing with even-indexed girls swap positions with boys who are dancing with odd-indexed girls. That is the one who was dancing with the girl 11 swaps with the one who was dancing with the girl number 22 , while the one who was dancing with girl number 33 swaps with the one who was dancing with the girl number 44 and so one. It's guaranteed that nn is even.

Your task is to determine the final position of each boy.

输入格式

The first line of the input contains two integers nn and qq ( 2<=n<=10000002<=n<=1000000 , 1<=q<=20000001<=q<=2000000 ) — the number of couples in the rueda and the number of commands to perform, respectively. It's guaranteed that nn is even.

Next qq lines contain the descriptions of the commands. Each command has type as the integer 11 or 22 first. Command of the first type is given as xx ( n<=x<=n-n<=x<=n ), where 0<=x<=n0<=x<=n means all boys moves xx girls in clockwise direction, while x-x means all boys move xx positions in counter-clockwise direction. There is no other input for commands of the second type.

输出格式

Output nn integers, the ii -th of them should be equal to the index of boy the ii -th girl is dancing with after performing all qq moves.

输入输出样例

  • 输入#1

    6 3
    1 2
    2
    1 2
    

    输出#1

    4 3 6 5 2 1
    
  • 输入#2

    2 3
    1 1
    2
    1 -2
    

    输出#2

    1 2
    
  • 输入#3

    4 2
    2
    1 3
    

    输出#3

    1 4 3 2
    
首页