問題一覧 > 通常問題

No.716 Distance

レベル : / AI推定難易度 : 124 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 533
作問者 : butsurizuki / テスター : ciel
お気に入りにしたユーザー ProblemId : 1810 / 自分の提出
問題文最終更新日: 2022-08-09 21:58:37
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 196 (順位表) の他の問題:

Problem Statement

There are $N$ points on a line $l$.
Their positions are $a_1,a_2…a_N$ (integers).
Find the minimum and maximum values of the distance between any two points.

In the figure, $a_n$ is an error for $a_N$. (Added 2022/08/09)

Input

$N$
$a_1$ $a_2$ $a_3$ $\dots$ $a_N$

The input consists of two lines. The first line gives the number of points $N$, and the second line gives the positions $a$.
・Constraints
$2 \le N \le 1000$
$a_i \le a_{i+1}$ ($1 \le i \le N-1$)
$-10^5 \le a_i \le 10^5$ ($1 \le i \le N$)

Output

Print the minimum distance on the first line and the maximum distance on the second line, followed by a newline at the end.

Sample

Sample 1
Input
4
-1 0 2 3
Output
1
4

Sample 2
Input
3
-1 1 1
Output
0
2

There may be multiple points at the same position, in which case their distance is 0.

Sample 3
Input
2
-100000 100000
Output
200000
200000

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。