atcoder#ARC120E. [ARC120E] 1D Party
[ARC120E] 1D Party
Score : points
Problem Statement
There are people, Person through Person , standing on a number line. Person is now at coordinate on the number line. Here, and all are even numbers.
We will now hold a party for seconds. During the party, each person can freely move on the number line at a speed of at most per second. (It is also allowed to move in the negative direction within the speed limit.) The people request that the following condition be satisfied for every integer such that :
- there is at least one moment during the party (including the moment it ends) when Person and Person are at the same coordinate.
Find the minimum for which there is a strategy that the people can take to satisfy all the conditions. We can prove that the answer is an integer under the Constraints of this problem.
Constraints
- is an even number.
Input
Input is given from Standard Input in the following format:
Output
Print the answer as an integer.
3
0 6 10
5
During the party lasting seconds, each person should move as follows:
- Person : always moves in the positive direction at a speed of .
- Person : moves in the positive direction at a speed of during the first seconds, then in the negative direction at a speed of during the remaining seconds.
- Person : always moves in the negative direction at a speed of .
If they move in this way, Person and Person will be at the same coordinate exactly seconds after the beginning, and Person and Person will be at the same coordinate at the end of the party. Thus, they can satisfy all the conditions for . For smaller , there is no strategy to satisfy all of them.
5
0 2 4 6 8
3
During the party lasting seconds, each person should, for example, move as follows:
- Person : always moves in the positive direction at a speed of .
- Person : moves in the positive direction at a speed of during the first seconds, then in the negative direction at a speed of during the remaining second.
- Person : does not move at all.
- Person : moves in the negative direction at a speed of during the first seconds, then in the positive direction at a speed of during the remaining second.
- Person : always moves in the negative direction at a speed of .
10
0 2 4 6 8 92 94 96 98 100
44