#638
Silver II
Rotate and Shift
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Note: The time limit for this problem is 4s, 2x the default.

To celebrate the start of spring, Farmer John's NN cows (1N21051 \leq N \leq 2 \cdot 10^5) have invented an intriguing new dance, where they stand in a circle and re-order themselves in a predictable way.

Specifically, there are NN positions around the circle, numbered sequentially from 00 to N1N-1, with position 00 following position N1N-1. A cow resides at each position. The cows are also numbered sequentially from 00 to N1N-1. Initially, cow ii starts in position ii. You are told a set of KK positions 0=A1<A2<<AK<N0=A_1<A_2< \ldots< A_K<N that are "active", meaning the cows in these positions are the next to move (1KN1 \leq K \leq N).

In each minute of the dance, two things happen. First, the cows in the active positions rotate: the cow at position A1A_1 moves to position A2A_2, the cow at position A2A_2 moves to position A3A_3, and so on, with the cow at position AKA_K moving to position A1A_1. All of these KK moves happen simultaneously, so the after the rotation is complete, all of the active positions still contain exactly one cow. Next, the active positions themselves shift: A1A_1 becomes A1+1A_1+1, A2A_2 becomes A2+1A_2+1, and so on (if Ai=N1A_i = N-1 for some active position, then AiA_i circles back around to 00).

Please calculate the order of the cows after TT minutes of the dance (1T1091\le T\le 10^9).

입력

The first line contains three integers NN, KK, and TT.

The second line contains KK integers representing the initial set of active positions A1,A2,AKA_1,A_2, \ldots A_K. Recall that A1=0A_1 = 0 and that these are given in increasing order.

출력

Output the order of the cows after TT minutes, starting with the cow in position 00, separated by spaces.

예제 입력 1

5 3 4
0 2 3

예제 출력 1

1 2 3 4 0

점수

Inputs 2-7: N1000,T10000N \leq 1000, T \leq 10000Inputs 8-13: No additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Silver II1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.