/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 300 点
問題文
N 人の子供たちが円形に並んで座っています。子供たちには 1 から N までの番号が付けられており、時計回りに子供 1, 子供 2, \ldots, 子供 N の順に並んでいます(子供 N の時計回りの隣は子供 1 です)。最初、子供 i は番号 i が書かれたカードを 1 枚持っています。
次の操作を K 回繰り返します。
- 全員が同時に、自分の持っているカードを時計回りの隣の子供に渡す。すなわち、子供 i(1 \leq i \leq N-1)は子供 i+1 に、子供 N は子供 1 に、それぞれ自分のカードを渡す。
各操作において全員がちょうど 1 枚渡してちょうど 1 枚受け取るため、操作後も各子供はちょうど 1 枚のカードを持ちます。
K 回の操作後、各子供が持っているカードに書かれた番号を求めてください。
制約
- 1 \leq N \leq 2 \times 10^5
- 0 \leq K \leq 10^{18}
- 入力はすべて整数である
入力
入力は以下の形式で与えられます。
N K
子供の人数 N と操作の回数 K がスペース区切りで与えられます。
出力
操作を K 回行った後の、子供 i(1 \leq i \leq N)が持っているカードに書かれた番号を、子供 1 から子供 N の順に、1 行に 1 つずつ出力してください。
入力例 1
5 2
出力例 1
4 5 1 2 3
入力例 2
6 0
出力例 2
1 2 3 4 5 6
入力例 3
12 25
出力例 3
12 1 2 3 4 5 6 7 8 9 10 11
入力例 4
1 1000000000000000000
出力例 4
1
Score : 300 pts
Problem Statement
N children are sitting in a circle. The children are numbered from 1 to N, and they are arranged in clockwise order as child 1, child 2, \ldots, child N (the clockwise neighbor of child N is child 1). Initially, child i holds exactly one card with the number i written on it.
The following operation is repeated K times:
- Everyone simultaneously passes their card to the child next to them in the clockwise direction. That is, child i (1 \leq i \leq N-1) passes their card to child i+1, and child N passes their card to child 1.
In each operation, everyone passes exactly one card and receives exactly one card, so after the operation each child still holds exactly one card.
After K operations, determine the number written on the card that each child is holding.
Constraints
- 1 \leq N \leq 2 \times 10^5
- 0 \leq K \leq 10^{18}
- All input values are integers
Input
The input is given in the following format:
N K
The number of children N and the number of operations K are given separated by a space.
Output
After performing the operation K times, output the number written on the card held by child i (1 \leq i \leq N), one per line, in order from child 1 to child N.
Sample Input 1
5 2
Sample Output 1
4 5 1 2 3
Sample Input 2
6 0
Sample Output 2
1 2 3 4 5 6
Sample Input 3
12 25
Sample Output 3
12 1 2 3 4 5 6 7 8 9 10 11
Sample Input 4
1 1000000000000000000
Sample Output 4
1