How can we solve this Problem ?

Revision en2, by Duukh, 2023-07-26 22:09:31

I just found this problem and i don't have any idea how to solve it .

Given an array A of n distinct elements ai such that 1 <= ai <= 10^12 and 1 <= n <= 10^5 Find the length k of any sequence of indices i1,i2,....,ik ( 1 <= i1 < i2 <....< ik <=n ) 1. Such that there exists an integer m (m > 1) that satisfies ai1 = ai2 = ... = aik (mod m) . 2. k is maximized

Sample :

Input

5

6 11 16 21 26

Output 5

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Duukh 2023-07-26 22:10:21 6
en2 English Duukh 2023-07-26 22:09:31 5 Tiny change: '\nInput \n5\n6 11 16 ' -> '\nInput \n\n5\n\n6 11 16 '
en1 English Duukh 2023-07-26 22:04:34 468 Initial revision (published)