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↵
5↵
↵
6 11 16 21 26↵
↵
Output↵
5
↵
↵
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