#P5824. 十二重计数法

    ID: 6507 远端评测题 2000ms 256MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>数学O2优化组合数学生成函数快速傅里叶变换 FFT快速数论变换 NTT

十二重计数法

Background

Combinatorics is an old and fascinating subject.

Legend has it that as early as 114514114514 years ago, a deity named Yi Ai came to Earth and discovered humans—another intelligent species.

She found this very interesting. In order to speed up the development of human civilization, she passed down to the human world a type of counting problem—the twelvefold counting. This was also the beginning of combinatorics.

Only by figuring out this type of problem can one continue to go deeper in combinatorics.

Problem Description

There are nn balls and mm boxes, and all balls must be put into the boxes. There are also some constraints. How many ways are there to place the balls? (The order of placing does not matter.)

The constraints are as follows:

I\text{I}: All balls are distinct, and all boxes are distinct.
II\text{II}: All balls are distinct, and all boxes are distinct; each box holds at most one ball.
III\text{III}: All balls are distinct, and all boxes are distinct; each box holds at least one ball.

IV\text{IV}: All balls are distinct, and all boxes are identical.
V\text{V}: All balls are distinct, and all boxes are identical; each box holds at most one ball.
VI\text{VI}: All balls are distinct, and all boxes are identical; each box holds at least one ball.

VII\text{VII}: All balls are identical, and all boxes are distinct.
VIII\text{VIII}: All balls are identical, and all boxes are distinct; each box holds at most one ball.
IX\text{IX}: All balls are identical, and all boxes are distinct; each box holds at least one ball.

X\text{X}: All balls are identical, and all boxes are identical.
XI\text{XI}: All balls are identical, and all boxes are identical; each box holds at most one ball.
XII\text{XII}: All balls are identical, and all boxes are identical; each box holds at least one ball.

Since the answer may be very large, take it modulo 998244353998244353.

Input Format

Only one line with two positive integers n,mn,m.

Output Format

Output twelve lines. Each line contains one integer, corresponding to the answer under each constraint.

13 6
83517427
0
721878522
19628064
0
9321312
8568
0
792
71
0
14

Hint

Constraints
For 100%100\% of the testdata, 1n,m2×1051\le n,m \le 2\times 10^5.

orz EntropyIncreaser\mathsf E \color{red}\mathsf{ntropyIncreaser}

Translated by ChatGPT 5