11265: [yosupo] Graph - Chromatic Polynomial
[Creator : ]
Description
Given an undirected graph $G$ with $N$ vertices and $M$ edges. The $i$-th edge is $\lbrace u_i, v_i\rbrace$.
Calculate the chromatic polynomial $P(G,x)=p_0+p_1+\cdots+p_Nx^N$ modulo $998244353$.
Input
$N$ $M$
$u_0$ $v_0$
$u_1$ $v_1$
:
$u_{M - 1}$ $v_{M - 1}$
$u_0$ $v_0$
$u_1$ $v_1$
:
$u_{M - 1}$ $v_{M - 1}$
Output
$p_0$ $p_1$ $\cdots$ $p_N$
Constraints
- $1 \leq N \leq 20$
- $0 \leq M \leq 500$
- $0 \leq u_i, v_i < N$
- $0 \leq M \leq 500$
- $0 \leq u_i, v_i < N$
Sample 1 Input
5 7
0 1
0 2
0 4
1 3
2 3
2 4
3 4
Sample 1 Output
0 10 998244330 19 998244346 1
Sample 2 Input
20 0
Sample 2 Output
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Sample 3 Input
3 1
2 2
Sample 3 Output
0 0 0 0
2 5
0 1
1 0
0 1
0 1
1 0
0 998244352 1