問題一覧 > 通常問題

No.1379 Postponed

レベル : / AI推定難易度 : 2225 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 10
作問者 : leaf_1415 / テスター : 37zigen
お気に入りにしたユーザー ProblemId : 5391 / 自分の提出
問題文最終更新日: 2020-11-13 14:52:37
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 281 (順位表) の他の問題:

Problem Statement

You are given a sequence of positive integers $A^{(0)} = (A^{(0)}_1, A^{(0)}_2, \ldots, A^{(0)}_N)$ of length $N$.
The sequence $A^{(0)}$ is sorted in ascending order.
That is, for every integer $i$ satisfying $1 \leq i \leq N-1$, $A^{(0)}_i \leq A^{(0)}_{i+1}$ holds.

For $t = 1, 2, 3, \ldots$, the sequence $A^{(t)} = (A^{(t)}_1, A^{(t)}_2, \ldots, A^{(t)}_N)$ is defined recursively as follows.

$\begin{equation}
A^{(t)}_i := \begin{cases} A^{(t-1)}_{i+1} & (\text{if}\,\, i < A^{(t-1)}_1 + 1)\\
A^{(t-1)}_1 & (\text{if}\,\, i = A^{(t-1)}_1 + 1)\\
A^{(t-1)}_{i} & (\text{if}\,\, i > A^{(t-1)}_1 + 1)\\
\end{cases}\end{equation} \,\,\,\,\,\, (\text{for}\,\, i = 1, 2, \ldots, N)$

That is, the sequence $A^{(t)}$ is obtained from the sequence $A^{(t-1)}$ by cyclically shifting its first $A^{(t-1)}_1+1$ elements to the left $1$ time.

Given a non-negative integer $K$, find the sequence $A^{(K)}$.

Input

$N\ K$
$A^{(0)}_1\ A^{(0)}_2\ \cdots\ A^{(0)}_N$

$2 \leq N \leq 100$
$0 \leq K \leq 10^{18}$
$1 \leq A^{(0)}_i \leq N-1$
$A^{(0)}_i \leq A^{(0)}_{i+1}$
All inputs are integers.

Output

$A^{(K)}_1\ A^{(K)}_2\ \cdots\ A^{(K)}_N$

Print the elements of $A^{(K)}$ in the order $A^{(K)}_1, A^{(K)}_2, \ldots, A^{(K)}_N$ on one line, separated by spaces.
Print a newline at the end.

Sample

Sample 1
Input
5 3
2 3 3 4 4
Output
2 4 3 3 4

$A^{(0)} = (2, 3, 3, 4, 4)$
$A^{(1)} = (3, 3, 2, 4, 4)$
$A^{(2)} = (3, 2, 4, 3, 4)$
$A^{(3)} = (2, 4, 3, 3, 4)$
as shown above.

Sample 2
Input
10 1000
1 3 4 5 5 6 8 8 9 9
Output
1 4 3 5 5 6 8 9 8 9

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。