301602: CF303C. Minimum Modular

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Minimum Modular

题意翻译

给出 $ n $ 和 $ n $ 个正整数 $ a_1 ,a_2 ,\ ...\ ,a_n $ 你最多可以删除其中 $ k $ 个数字,求出一个最小的 $ m $ ,使剩下的数字模 $ m $ 后的值互不相同

题目描述

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: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF303C/e08769ae8f052f7d357ba6c3db7e7cd896370f65.png).

输入输出格式

输入格式


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

Input

题意翻译

给出 $ n $ 和 $ n $ 个正整数 $ a_1 ,a_2 ,\ ...\ ,a_n $ 你最多可以删除其中 $ k $ 个数字,求出一个最小的 $ m $ ,使剩下的数字模 $ m $ 后的值互不相同

加入题单

算法标签: