#1191. 【算法1-6】路标设置

【算法1-6】路标设置

说明

现在政府决定在公路上增设一些路标,使得公路的“空旷指数”最小。他们请求你设计一个程序计算能达到的最小值是多少。请注意,公路的起点和终点保证已设有路标,公路的长度为整数,并且原有路标和新设路标都必须距起点整数个单位距离。

输入格式

第 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn></mrow></semantics></math>1 行包括三个数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo separator="true">,</mo><mi>�</mi><mo separator="true">,</mo><mi>�</mi></mrow></semantics></math>L,N,K,分别表示公路的长度,原有路标的数量,以及最多可增设的路标数量。

第 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn></mrow></semantics></math>2 行包括递增排列的 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>N 个整数,分别表示原有的 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>N 个路标的位置。路标的位置用距起点的距离表示,且一定位于区间 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">[</mo><mn>0</mn><mo separator="true">,</mo><mi>�</mi><mo stretchy="false">]</mo></mrow></semantics></math>[0,L] 内。

输出格式

输出 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn></mrow></semantics></math>1 行,包含一个整数,表示增设路标后能达到的最小“空旷指数”值

样例

101 2 1
0 101
51

提示

数据范围:

公路原来只在起点和终点处有两个路标,现在允许新增一个路标,应该把新路标设在距起点 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>50</mn></mrow></semantics></math>50 或 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>51</mn></mrow></semantics></math>51 个单位距离处,这样能达到最小的空旷指数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>51</mn></mrow></semantics></math>51

<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>50</mn><mi mathvariant="normal">%</mi></mrow></semantics></math>50% 的数据中,<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>100</mn></mrow></semantics></math>2N100<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>100</mn></mrow></semantics></math>0K100

<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>100</mn><mi mathvariant="normal">%</mi></mrow></semantics></math>100% 的数据中,<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>100000</mn></mrow></semantics></math>2N100000<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>100000</mn></mrow></semantics></math>0K100000

<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>100</mn><mi mathvariant="normal">%</mi></mrow></semantics></math>100% 的数据中,<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn><mo><</mo><mi>�</mi><mo>≤</mo><mn>10000000</mn></mrow></semantics></math>0<L10000000