P29726 [洛谷] 「EZEC-9」Meltel
省选
题目描述

Problem Background

貴方だけは許せない。
『唯独你不可原谅。』
貴方だけは私の全てを許してくれた。
『唯独你宽恕了我的一切。』
貴方だけは私の全てを奪い尽くし食い尽くし
『唯独你覆灭了我的世界,』
焼き尽くして全てを無駄にした。
『焚烧殆尽,山陷地裂。』

Problem Description

Given a positive integer $n$, for $s=0,1,\dots,n$, count the number of labeled forests consisting of $n$ labeled rooted trees such that there are exactly $s$ binary trees. Output the result modulo $998244353$.

A binary tree is defined as a labeled rooted tree where each node has no more than $2$ children. Two forests are considered different if and only if there exist two nodes with different parents (the root node is considered to have no parent).

Input Format

The first line contains a positive integer $n$.

Output Format

Output one line with $n+1$ non-negative integers, representing the answers for $s=0,1,\dots,n$.

Sample Input and Output

Sample Input #1

3

Sample Output #1

0 9 6 1

Sample Input #2

4

Sample Output #2

4 60 48 12 1

Sample Input #3

5

Sample Output #3

85 560 480 150 20 1

Notes

Sample 1 Explanation

With 3 nodes, only binary trees can be formed, so the number of forests with $s=0$ is $0$.
There are $9$ labeled rooted binary trees with 3 nodes, so the number of forests with $s=1$ is $9$.
There are $2$ labeled rooted binary trees with 2 nodes, so the number of forests with $s=2$ is $3 \times 2 = 6$.
A single node is also considered a labeled rooted binary tree, so the number of forests with $s=3$ is $1$.

Data Range and Constraints

This problem uses batched testing.

  • Subtask 1 (5 points): $n \le 5$.
  • Subtask 2 (5 points): $n \le 10$.
  • Subtask 3 (30 points): $n \le 10^3$.
  • Subtask 4 (30 points): $n \le 8 \times 10^3$.
  • Subtask 5 (30 points): No special restrictions.

For $100\%$ of the data, $1 \le n \le 2 \times 10^5$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3
样例输出
0 9 6 1