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.

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.