In the event of technical difficulties with Szkopuł, please contact us via email at szkopul@fri.edu.pl.
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
On the bed of one particularly long and straight Byteotian brook there lie rocks
jutting above the water level.
Their distances from the brook's spring are
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
-th closest to the one it is sitting on.
Specifically, if the frog is sitting on the rock at position
, then it will leap onto such
that:
and
If 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
leaps depending on the rock is started from?
The first line of the standard input holds three integers,
,
and
(
,
),
separated by single spaces, that denote respectively: the number of rocks,
the parameter
, and the number of intended leaps.
The second line holds
integers
(
), separated by single spaces,
that denote the positions of successive rocks on the bed of the brook.
Your program should print a single line on the standard output,
with integers
from the interval
in it, separated by single spaces.
The number
denotes the number of the rock that the frog ends on
after making
leaps starting from the rock no.
(in the input order).
For the input data:
5 2 4 1 2 4 7 10
the correct result is:
1 1 3 1 1
The figure presents where the frog leaps to (in a single leap) from each and every rock.
Task author: Jakub Radoszewski.