#P9004. [RC-07] Abnormal Permutation Tuples

[RC-07] Abnormal Permutation Tuples

Problem Description

You are given three positive integers nn, mm, and modmod.

How many ordered mm-tuples of permutations of 1n1 \sim n, (p1,p2,,pm)(p_1, p_2, \dots, p_m), satisfy:

  • Lexicographical order: p1<p2<<pmp_1 \lt p_2 \lt \dots \lt p_m.
  • Inversion count: p1>p2>>pmp_1 \gt p_2 \gt \dots \gt p_m.

Let f(n,m)f(n,m) be the answer modulo modmod. For all 1in1 \le i \le n and 1jm1 \le j \le m, output f(i,j)f(i,j).

Input Format

The input contains one line with three positive integers nn, mm, modmod.

Output Format

Output an n×mn \times m matrix, where the entry in row ii and column jj is f(i,j)f(i,j).

5 3 23333
1 0 0
2 0 0
6 0 0
24 17 0
120 904 1226

Hint

It is guaranteed that 2mod1092 \le mod \le 10^9, 1n151 \le n \le 15, and 1m301 \le m \le 30. Note that nn and mm will not simultaneously take the values 1515 and 3030.

The Constraints for nn and mm are as follows:

  • Subtask 1 (2020 points): n=7n = 7, m=30m = 30.
  • Subtask 2 (1010 points): n=10n = 10, m=10m = 10.
  • Subtask 3 (2020 points): n=11n = 11, m=10m = 10.
  • Subtask 4 (1010 points): n=12n = 12, m=8m = 8.
  • Subtask 5 (2020 points): n=13n = 13, m=15m = 15.
  • Subtask 6 (1010 points): n=14n = 14, m=30m = 30.
  • Subtask 7 (1010 points): n=15n = 15, m=20m = 20.

Translated by ChatGPT 5