QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB Total points: 100

#579. Frog

الإحصائيات

On the bed of one particularly long and straight Byteotian brook there lie $n$ rocks jutting above the water level. Their distances from the brook's spring are $p_1 < p_2 < … < p_n$ respectively. A small frog sitting on one of these is about to begin its leaping training. Each time the frog leaps to the rock that is the $k$-th closest to the one it is sitting on. Specifically, if the frog is sitting on the rock at position $p_i$, then it will leap onto such $p_j$ that:

$$|{p_a : |p_a-p_i| < |p_j-p_i|}| ≤ k \text{ and } |{p_a : |p_a-p_i| ≤ |p_j-p_i|}| > k.$$

If $p_j$ is not unique, then the frog chooses among them the rock that is closest to the spring. On which rock the frog will be sitting after $m$ leaps depending on the rock is started from?

Input

The first line of the standard input holds three integers, $n$, $k$ and $m$ ($1 ≤ k < n ≤ 1\,000\,000$, $1 ≤ m ≤ 10^{18}$), separated by single spaces, that denote respectively: the number of rocks, the parameter $k$, and the number of intended leaps. The second line holds $n$ integers $p_j$ ($1 ≤ p_1 < p_2 < … < p_n ≤ 10^{18}$), separated by single spaces, that denote the positions of successive rocks on the bed of the brook.

Output

Your program should print a single line on the standard output, with $n$ integers $r_1, r_2, …, r_n$ from the interval $[1,n]$ in it, separated by single spaces. The number $r_i$ denotes the number of the rock that the frog ends on after making $m$ leaps starting from the rock no. $i$ (in the input order).

Example

Input

5 2 4
1 2 4 7 10

Output

1 1 3 1 1
problem_579_1.gif

The figure presents where the frog leaps to (in a single leap) from each and every rock.

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.