#P7851. 「JZOI-2」信号塔
「JZOI-2」信号塔
Background
All the members are thinking about organizing the anniversary celebration, but Xiao Xi just wants to slack off (moyu).
Xiao Xi wants to watch TV, but he finds there is no signal, so he goes to fix the signal tower.
Problem Description
On a straight line with points, the distance between adjacent points on the line is the same. A signal tower is built at every point, numbered from left to right as , where tower is the TV program transmission point.
Since Xiao Xi only wants to watch TV, the signal here is transmitted only from left to right. Suppose a signal tower has strength , then its signal can be transmitted at most a distance of to the right.
Now Xiao Xi needs to set a strength for each signal tower, but there are too many towers and he cannot handle it, so he hands it to the "Benben robot" to do.
The Benben robot sets the strength for each signal tower in the following way.
First, set the strength of tower to . Then, from left to right, start from signal tower and continue until signal tower . For each signal tower, find the nearest signal tower on its left such that the signal of tower can be transmitted to this signal tower, and then assign this signal tower’s strength to be the distance between these two signal towers.
Here, the distance between signal tower and signal tower is defined as .
For example, when , the strengths of signal towers are , respectively.
However, Xiao Xi still does not trust the Benben robot, so he wants to know the strength of the -th signal tower.
Input Format
One line with two positive integers .
Their meanings are as described in the statement.
Output Format
One line with one integer, indicating the strength of the signal tower with index .
1 1
1
5 2
5
Hint
For of the testdata, .
For of the testdata, .
For another of the testdata, .
For another of the testdata, .
For of the testdata, .
Translated by ChatGPT 5