题库练习 Minimum Modular
← 上一题 下一题 →

A9034 | Minimum Modular

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You have been given $n$ distinct integers $a_{1},a_{2},...,a_{n}$ . You can remove at most $k$ of them. Find the minimum modular $m$ $(m>0)$ , so that for every pair of the remaining integers $(a_{i},a_{j})$ , the following unequality holds: ![](/uploads/acgo/image/1266c8ce3851d693_b4ce7fbeee23.jpeg).

输入格式

The first line contains two integers $n$ and $k$ ( $1<=n<=5000,0<=k<=4$ ), which we have mentioned above.

The second line contains $n$ distinct integers $a_{1},a_{2},...,a_{n}$ $(0<=a_{i}<=10^{6})$ .

输出格式

Print a single positive integer — the minimum $m$ .

输入输出样例

输入 #1
7 0
0 2 3 6 7 12 18
输出 #1
13
输入 #2
7 1
0 2 3 6 7 12 18
输出 #2
7
C++ 编辑器
输入
输出