QOJ.ac

QOJ

Límite de tiempo: 2.0 s Límite de memoria: 256 MB Puntuación total: 100

#14103. LIS 计数

Estadísticas

给定整数 $N, M$ 和一个质数模数 $P$。

考虑所有长度为 $N \cdot M$ 的排列,满足其最长上升子序列的长度等于 $N$,且最长下降子序列的长度等于 $M$。

对于每个 $1 \le pos, val \le N \cdot M$,定义 $f(pos, val)$ 为在所有满足上述条件的排列中,第 $pos$ 个元素等于 $val$ 的排列数量。

求所有 $1 \le pos, val \le NM$ 的 $f(pos, val) \bmod P$ 的值。

输入格式

输入只有一行,包含三个整数 $N, M, P$($1 \le N \cdot M \le 100$,$10^8 \le P \le 10^9$,$P$ 为质数)。

输出格式

输出一个大小为 $NM \times NM$ 的矩阵,其中第 $pos$ 行的第 $val$ 个值应当等于 $f(pos, val) \bmod P$。

样例

输入样例 1

3 2 998244353

输出样例 1

0 10 10 5 0 0
10 0 0 6 9 0
10 0 0 4 6 5
5 6 4 0 0 10
0 9 6 0 0 10
0 0 5 10 10 0

输入样例 2

1 7 100000007

输出样例 2

0 0 0 0 0 0 1
0 0 0 0 0 1 0
0 0 0 0 1 0 0
0 0 0 1 0 0 0
0 0 1 0 0 0 0
0 1 0 0 0 0 0
1 0 0 0 0 0 0

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#839EditorialOpen题解alpha10222026-01-28 02:15:10View

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.