NOMURA プログラミングコンテスト2022(AtCoder Beginner Contest 253)
Ex
We Love Forest
AtCoder
⌀ 2758
原题
←G →
翻译中…

Problem Statement

翻译中…

We have a graph $G$ with $N$ vertices numbered $1$ through $N$ and $0$ edges. You are given sequences $u=(u_1,u_2,\ldots,u_M),v=(v_1,v_2,\ldots,v_M)$ of length $M$.

翻译中…

You will perform the following operation $(N-1)$ times.

翻译中…
  • Choose $i$ $(1 \leq i \leq M)$ uniformly at random. Add to $G$ an undirected edge connecting Vertices $u_i$ and $v_i$.
翻译中…

Note that the operation above will add a new edge connecting Vertices $u_i$ and $v_i$ even if $G$ already has one or more edges between them. In other words, the resulting $G$ may contain multiple edges.

翻译中…

For each $K=1,2,\ldots,N-1$, find the probability, modulo $998244353$, that $G$ is a forest after the $K$-th operation.

翻译中…

What is a forest? An undirected graph without a cycle is called a forest. A forest is not necessarily connected.

翻译中…

Definition of probability modulo $998244353$ We can prove that the sought probability is always a rational number. Moreover, under the Constraints of this problem, it is guaranteed that, when the sought probability is represented by an irreducible fraction $\frac{y}{x}$, $x$ is indivisible by $998244353$. Then, we can uniquely determine an integer $z$ between $0$ and $998244352$ (inclusive) such that $xz \equiv y \pmod{998244353}$. Print this $z$.

翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 14$
  • $N-1 \leq M \leq 500$
  • $1 \leq u_i,v_i \leq N$
  • $u_i\neq v_i$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N M
u_1 v_1
\vdots
u_M v_M

翻译中…

Output

翻译中…

Print $N-1$ lines. The $i$-th line should contain the probability, modulo $998244353$, that $G$ is a forest after the $i$-th operation.

翻译中…

样例

Input #1
3 2
1 2
2 3
Output #1
1
499122177
Let us denote by $(u, v)$ the edge connecting Vertices $u$ and $v$. After the $1$-st operation, $G$ will have: - Edge $(1, 2)$ with a probability of $1/2$; - Edge $(2, 3)$ with a probability of $1/2$. In both cases, $G$ is a forest, so the answer for $K=1$ is $1$. After the $2$-nd operation, $G$ will have: - Edges $(1, 2)$ and $(1, 2)$ with a probability of $1/4$; - Edges $(2, 3)$ and $(2, 3)$ with a probability of $1/4$; - Edges $(1, 2)$ and $(2, 3)$ with a probability of $1/2$. $G$ is a forest only when $G$ has Edges $(1, 2)$ and $(2, 3)$. Therefore, the sought probability is $1/2$; when represented modulo $998244353$, it is $499122177$, which should be printed.
Input #2
4 5
1 2
1 2
1 4
2 3
2 4
Output #2
1
758665709
918384805
题目信息
题号
abc253_h
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。