P9004 [RC-07] Abnormal Permutation Tuples

Description

You are given three positive integers $n$, $m$, and $mod$. How many ordered $m$-tuples of permutations of $1 \sim n$, $(p_1, p_2, \dots, p_m)$, satisfy: - Lexicographical order: $p_1 \lt p_2 \lt \dots \lt p_m$. - Inversion count: $p_1 \gt p_2 \gt \dots \gt p_m$. Let $f(n,m)$ be the answer modulo $mod$. For all $1 \le i \le n$ and $1 \le j \le m$, output $f(i,j)$.

Input Format

The input contains one line with three positive integers $n$, $m$, $mod$.

Output Format

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

Explanation/Hint

It is guaranteed that $2 \le mod \le 10^9$, $1 \le n \le 15$, and $1 \le m \le 30$. **Note that $n$ and $m$ will not simultaneously take the values $15$ and $30$.** The Constraints for $n$ and $m$ are as follows: - Subtask 1 ($20$ points): $n = 7$, $m = 30$. - Subtask 2 ($10$ points): $n = 10$, $m = 10$. - Subtask 3 ($20$ points): $n = 11$, $m = 10$. - Subtask 4 ($10$ points): $n = 12$, $m = 8$. - Subtask 5 ($20$ points): $n = 13$, $m = 15$. - Subtask 6 ($10$ points): $n = 14$, $m = 30$. - Subtask 7 ($10$ points): $n = 15$, $m = 20$. Translated by ChatGPT 5