number of permutation with k inversions
-
06-11-2019 - |
Вопрос
We are given two numbers N and K.
N <= 10^9.
K<=min{1000,(N*(N-1))/2}
We need to find numbers of permutations of ( 1 to N ) such that inversions are exactly K.
If N was <= 10^3. It would be a simple Dynamic programming question.
https://www.geeksforgeeks.org/number-of-permutation-with-k-inversions/
can we optimize it?
Нет правильного решения
Не связан с cs.stackexchange