Preparando MOJI

Minimum Modular

2000ms 262144K

Description:

You have been given n distinct integers a1, a2, ..., an. You can remove at most k of them. Find the minimum modular m (m > 0), so that for every pair of the remaining integers (ai, aj), the following unequality holds: .

Input:

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 a1, a2, ..., an (0 ≤ ai ≤ 106).

Output:

Print a single positive integer — the minimum m.

Sample Input:

7 0
0 2 3 6 7 12 18

Sample Output:

13

Sample Input:

7 1
0 2 3 6 7 12 18

Sample Output:

7

Informação

Codeforces

Provedor Codeforces

Código CF303C

Tags

brute forcegraphsmathnumber theory

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 08:43:57

Relacionados

Nada ainda