#P7857. 「EZEC-9」Meltel

「EZEC-9」Meltel

Background

Only you are unforgivable.
"Only you cannot be forgiven."
Only you forgave everything about me.
"Only you forgave all of me."
Only you took everything from me, devoured it all,
"Only you destroyed my world,"
burned it all to ashes and turned everything into nothing.
"Burned it to the ground, mountains collapsing and the earth splitting."

Problem Description

Given a positive integer nn, for s=0,1,,ns=0,1,\dots,n, count the number of labeled forests consisting of labeled rooted trees on nn nodes such that there exist exactly ss binary trees.
Take the result modulo 998244353998244353.

A binary tree is defined as a labeled rooted tree where each node has at most 22 children.
Two forests are considered different if and only if there exists a node whose parent is different (treat the root as having no parent).

Input Format

The first line contains one positive integer nn.

Output Format

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

3
0 9 6 1
4
4 60 48 12 1
5
85 560 480 150 20 1

Hint

[Explanation for Sample 1]

With 33 nodes, only binary trees can appear, so the number of valid configurations for s=0s=0 is 00.
There are 99 labeled rooted binary trees on 33 nodes, so the number of valid configurations for s=1s=1 is 99.
There are 22 labeled rooted binary trees on 22 nodes, so the number of valid configurations for s=2s=2 is 3×2=63 \times 2 = 6.
A single node is also considered a labeled rooted binary tree, so the number of valid configurations for s=3s=3 is 11.

[Constraints]

This problem uses bundled testdata.

  • Subtask 1 (5 points): n5n \le 5.
  • Subtask 2 (5 points): n10n \le 10.
  • Subtask 3 (30 points): n103n \le 10^3.
  • Subtask 4 (30 points): n8×103n \le 8 \times 10^3.
  • Subtask 5 (30 points): no special constraints.

For 100%100\% of the testdata, 1n2×1051 \le n \le 2 \times 10^5

Translated by ChatGPT 5