测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A9034. Minimum Modular

编程题 普及/提高-

题目描述

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
上一题 去做题 下一题