Distinct multiplicative modulo values in Array

Правка en1, от MSKB, 2017-01-10 22:37:56

We are given an array A containing N elements (1<=N<=10^6). Now, we need to find all the distinct values (A[i]*A[j])%M where M is the product of two primes {both primes less than 600}. Clearly, it can be done in N^2 time but I am looking to solve this in time proportional to M (there can be atmost M distinct values).

Теги number theory, modular arithmetic

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский MSKB 2017-01-11 10:31:51 303
en1 Английский MSKB 2017-01-10 22:37:56 365 Initial revision (published)