product of every difference

Правка en1, от bihariforces, 2023-09-04 11:48:37

Given a sorted array where every element is distinct, we need to evaluate product of every difference, modulo $$$ 10^9 + 7 $$$

$$$ \prod_{i < j} (arr[j] - arr[i]) \% (10^9 + 7) $$$

Best approach I can think of is finding frequency of primes in product by grouping elements with same modular residue, which allows $$$ O(N * M / \log M) $$$ if $$$M$$$ is maximum number in array.

I have considered mathematical ways by polynomial multiplication and divide and conquer, which seems most promising but can't solve completely.

Is there any way to find this for arrays of length upto $$$ 10^ 5 $$$, and numbers upto $$$ 10 ^ 9 $$$?

Теги math, fft, divide and conquer, number theory

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский bihariforces 2023-09-04 11:48:37 642 Initial revision (published)