#P3509. [POI2010] ZAB-Frog
[POI2010] ZAB-Frog
题目描述
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).
题目大意
有 个点,升序给出每个点到起点的距离。有编号为 的 只青蛙分别在第 个点上,每次它们会跳到距离自己第 远的点上。
如果有相同距离的点,就跳到下标更小的点上。
求跳 次之后,第 只的青蛙在哪个点上。
输入共一行三个整数:代表 。
输出共一行 个整数,代表每只青蛙最终所处在的点。
5 2 4
1 2 4 7 10
1 1 3 1 1
提示
,,