P5219 Boring Easy Problem I.
Background
The problem setter is too weak and can only make this kind of problem. It is slightly time-limit tight.
Description
DLS likes climbing trees.
However, he does not want to put a data structure problem onto a tree; he likes counting Tree.
One day, he wants to build a tree by himself. He has $N$ nodes, labeled from $1$ to $N$, and he will connect edges between them. We define two trees to be different if and only if there exists a pair of nodes such that they are connected by an edge in one tree, but not connected by an edge in the other tree.
But he does not like a tree with too many branches, so he wants the maximum degree among all nodes in this tree to be $M$.
Since DLS is not very good at math and science, he hopes you can help him compute how many such trees there are.
Output the answer modulo $998244353$.
Input Format
A single line with two integers $N, M$.
Output Format
A single line with one integer, representing the answer.
Explanation/Hint
|Percentage of testdata|Constraints|
|-|-|
|$10\%$|$N, M \le 8$|
|$30\%$|$N, M \le 100$|
|$50\%$|$N, M \le 500$|
|$70\%$|$N, M \le 2000$|
|$100\%$|$2 \le N, M \le 5 \times 10^4$|
Translated by ChatGPT 5