| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 503 | 98 | 86 | 26.708% |
ICPC street is currently an undeveloped area, with a large-scale development plan scheduled soon. Before starting the development, information about $n$ important points along the street will be collected using $n$ remote-controlled robots, with each robot collecting information from one of these important points. Now, the goal is to combine all the collected information into a single robot to find the most efficient development approach. To combine the information, the robots can move towards left or right and combine the information that they have from other robots. Also, each robot is powered by its own battery, and all the robots are equipped with identical batteries. Specifically, let $p_1, p_2, \dots , p_n$ represent the positions of the important points where the robots collect information, arranged from left to right. Then the requirements are as follows:
For example, the figure above shows an example with $L = 10,ドル $n = 4,ドル and Robots 1ドル,ドル 2ドル,ドル 3ドル,ドル and 4ドル$ (R1, R2, R3, R4 in the figure) collect information (and are initially positioned) at $p_1 = 0,ドル $p_2 = 3,ドル $p_3 = 7,ドル and $p_4 = 10,ドル respectively. Then the following sequence of steps can be performed with a battery capacity of $P = 3$:
Then after completing the process, Robots 2ドル$ and 3ドル$ will have information about all the positions $p_1,ドル $p_2,ドル $p_3,ドル and $p_4$.
Since the battery is much more expensive than the other parts of robot, it is important to determine the minimum battery capacity required for each robot for efficient data collection. Given $L,ドル $n,ドル and the positions of the important points $p_1, p_2, \dots , p_n,ドル write a program to calculate the minimum battery capacity $P$ required for at least one robot to have information about all the points.
Your program is to read from standard input. The input starts with a line containing two positive integers, $L$ and $n$ (1ドル ≤ L ≤ 10^6$ , 2ドル ≤ n ≤ L + 1$), where $n$ is the number of robots and important points on the street and $L$ is the position of the right endpoint of the street. In the following line, $n$ distinct integers between 0ドル$ and $L$ that represent the positions of important points of the street (the initial positions of the robots) are given in increasing order, where the first integer is 0ドル$ and the last one is $L$.
Your program is to write to standard output. Print exactly one line. The line should contain a single integer that represents the minimum battery capacity $P$ required for at least one robot to have information about all the important points.
10 4 0 3 7 10
3
100 5 0 97 98 99 100
49
1 2 0 1
1
ICPC > Regionals > Asia Pacific > Korea > 2024 ICPC Asia Seoul Regional J번