#P5434. 有标号荒漠计数

    ID: 6163 远端评测题 3000ms 250MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>O2优化生成函数快速数论变换 NTT

有标号荒漠计数

Background

As everyone knows, counting cacti is a very easy counting problem, so we are going to make it harder.jpg.

Problem Description

A cactus is an undirected connected graph. In a cactus, any edge appears in at most one cycle. Also, in the cactus defined in this problem, the cactus must have no multiple edges and no self-loops.
A desert is an undirected graph in which every maximal connected component is a cactus.


Given an integer nn, find how many different deserts with nn vertices there are (the vertices are labeled).

Since the answer may be very large, you only need to output it modulo 998244353998244353.

Input Format

One line with one integer nn.

Output Format

One line with one integer, the answer modulo 998244353998244353.

3
8

Hint

For the sample, all possible cases are as follows:

You can see that there are no more deserts.


Constraints:
For 30%30\% of the testdata: n5000n\leqslant5000.
For 100%100\% of the testdata: 3n1000003\leqslant n\leqslant100000.

Translated by ChatGPT 5