Codeforces Round 283 (Div. 2)
A
Minimum Difficulty
Codeforces
900
原题
←B →
翻译中…

Mike is trying rock climbing but he is awful at it.

翻译中…

There are $*n*$ holds on the wall, $*i*$-th hold is at height $*a*_{*i*}$ off the ground. Besides, let the sequence $*a*_{*i*}$ increase, that is, $*a*_{*i*} < *a*_{*i* + 1}$ for all $*i*$ from 1 to $*n* - 1$; we will call such sequence a track. Mike thinks that the track $*a*_{1}$, ..., $*a*_{*n*}$ has difficulty image. In other words, difficulty equals the maximum distance between two holds that are adjacent in height.

翻译中…

Today Mike decided to cover the track with holds hanging on heights $*a*_{1}$, ..., $*a*_{*n*}$. To make the problem harder, Mike decided to remove one hold, that is, remove one element of the sequence (for example, if we take the sequence $(1, 2, 3, 4, 5)$ and remove the third element from it, we obtain the sequence $(1, 2, 4, 5)$). However, as Mike is awful at climbing, he wants the final difficulty (i.e. the maximum difference of heights between adjacent holds after removing the hold) to be as small as possible among all possible options of removing a hold. The first and last holds must stay at their positions.

翻译中…

Help Mike determine the minimum difficulty of the track after removing one hold.

翻译中…

Input

翻译中…

The first line contains a single integer $*n*$ ($3 ≤ *n* ≤ 100$) — the number of holds.

翻译中…

The next line contains $*n*$ space-separated integers $*a*_{*i*}$ ($1 ≤ *a*_{*i*} ≤ 1000$), where $*a*_{*i*}$ is the height where the hold number $*i*$ hangs. The sequence $*a*_{*i*}$ is increasing (i.e. each element except for the first one is strictly larger than the previous one).

翻译中…

Output

翻译中…

Print a single number — the minimum difficulty of the track after removing a single hold.

翻译中…

Note

翻译中…

In the first sample you can remove only the second hold, then the sequence looks like $(1, 6)$, the maximum difference of the neighboring elements equals 5.

翻译中…

In the second test after removing every hold the difficulty equals 2.

翻译中…

In the third test you can obtain sequences $(1, 3, 7, 8)$, $(1, 2, 7, 8)$, $(1, 2, 3, 8)$, for which the difficulty is 4, 5 and 5, respectively. Thus, after removing the second element we obtain the optimal answer — 4.

翻译中…

样例

Input #1
3
1 4 6
Output #1
5
InputCopy OutputCopy
Input #2
5
1 2 3 4 5
Output #2
2
InputCopy OutputCopy
Input #3
5
1 2 3 7 8
Output #3
4
InputCopy OutputCopy
题目信息
题号
496A
时间限制
2 s
内存限制
256 MB
标签
暴力
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。