#P6295. 有标号 DAG 计数

    ID: 6142 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 显示难度NOI/NOI+/CTS 上传者: 标签>洛谷原创O2优化容斥原理

有标号 DAG 计数

Problem Description

Count the number of labeled directed acyclic graphs (DAGs) on nn vertices with the requirement that the graph is weakly connected (that is, after replacing all directed edges with undirected edges, the resulting graph is connected). Output the answer modulo 998244353998244353.

Input Format

An integer TT.

Output Format

There are TT lines. On the ii-th line (1iT)(1\le i\le T), output the answer when n=in=i.

5
1
2
18
446
26430

Hint

The first test point has T=2000T = 2000.

The second test point has T=100000T = 100000.

Translated by ChatGPT 5