#P1521. 求逆序对

求逆序对

Description

We call (i,j)(i, j) an inversion of a1,a2,,aNa_1, a_2, \cdots, a_N if and only if i<ji < j and ai>aja_i > a_j. For example, [2,4,1,3,5][2, 4, 1, 3, 5] has 3 inversions: (1,3),(2,3),(2,4)(1, 3), (2, 3), (2, 4). Now given NN and KK, find the number of permutations of 1,2,3,,N1, 2, 3, \cdots, N whose number of inversions is exactly KK. Output that count.

For example, when N=5N = 5, K=3K = 3, there are 15 valid permutations. They are:

  • [1, 2, 5, 4, 3].
  • [1, 3, 4, 5, 2].
  • [1, 3, 5, 2, 4].
  • [1, 4, 2, 5, 3].
  • [1, 4, 3, 2, 5].
  • [1, 5, 2, 3, 4].
  • [2, 1, 4, 5, 3].
  • [2, 1, 5, 3, 4].
  • [2, 3, 1, 5, 4].
  • [2, 3, 4, 1, 5].
  • [2, 4, 1, 3, 5].
  • [3, 1, 2, 5, 4].
  • [3, 1, 4, 2, 5].
  • [3, 2, 1, 4, 5].
  • [4, 1, 2, 3, 5].

Input Format

The first line contains two integers NN and KK.

Output Format

Output the number of permutations of 1N1 \cdots N whose number of inversions is KK. To avoid big integer arithmetic, output the result modulo 1000010000.

5 3
15

Hint

Constraints

For all testdata, it is guaranteed that N100N \le 100, KN×(N1)/2K \le N \times (N - 1) / 2.

Translated by ChatGPT 5