| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 4 초 | 512 MB | 239 | 36 | 18 | 9.474% |
You are given an array of integers $a_1, a_2, \ldots, a_n$.
Find the maximum possible greatest common divisor of all numbers from the array if you can erase no more than $k$ elements ($k \le \frac{n}{2}$) from this array.
The first line contains two integers: $n,ドル the number of elements in the array, and $k,ドル the maximum number of elements you can erase (2ドル \le n \le 10^5,ドル 0ドル \le k \le \frac{n}{2}$).
The second line contains $n$ integers $a_1, a_2, \ldots, a_n$: the array $a$ (1ドル \le a_i \le 10^{18}$).
Print the maximum possible greatest common divisor of all elements of the array after erasing no more than $k$ elements.
4 1 6 15 35 14
1
4 2 6 15 35 14
7
3 1 897612484786617600 5828 16027
1457