Choose k elements fromff an array so that the GCD is maximise.

Правка en1, от Loserinlife, 2023-05-30 17:45:20

Choose k elements from an array so that their GCD is maximise.

Constraints: N <= 3000 K <= N <= 100 Ai <= 10^10 (ten to the power of 10) I tried an algorithm of enumerating all divisors of ai and find the largest divisors that exists in >= k elements but it TLE. Can somebody help? Thanks in advance.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Loserinlife 2023-05-30 17:59:01 4 Tiny change: '00\nK <= N <= 100\nA' -> '00\nK <= N; K <= 100\nA'
en1 Английский Loserinlife 2023-05-30 17:45:20 373 Initial revision (published)