#P12232. Inverse of Set Power Series
Inverse of Set Power Series
Inverse of Set Power Series
Given a set power series \(F(x)\) defined on the subsets of \(\{1, 2, \cdots, n\}\), where the multiplication of the indeterminate \(x\) is defined via subset convolution, you are guaranteed that \([x^{\varnothing}]F(x) \neq 0\) (here \(\varnothing\) is the empty set). It can be proven that there exists a series \(G(x)\) satisfying \[ F(x)\,G(x)=1, \quad\text{that is,}\quad \sum_{T\subseteq S} F(T)\,G(S\setminus T) = \begin{cases}1,& S=\varnothing,\\0,& S\neq \varnothing.\end{cases} \] Your task is to compute \([x^S]G(x)\) modulo \(998244353\) for each subset \(S\subseteq\{1,2,\ldots,n\}\.
Note: The input provides \(F(x)\) in the form of \(2^n\) integers corresponding to the coefficients \(F(S)\) in the order of increasing bitmask (with the 0th coefficient representing the empty set). You must output the coefficients \(G(S)\) in the same order.
inputFormat
The first line contains a single integer \(n\) (\(1 \leq n \leq 20\)).
The second line contains \(2^n\) integers \(F(S)\) separated by spaces, where the \(i\)-th number (0-indexed) corresponds to the coefficient of \(x^S\) (with the empty set represented by index 0). It is guaranteed that \(F(\varnothing) \neq 0\).
outputFormat
Output \(2^n\) integers separated by spaces. The \(i\)-th integer should be the value of \([x^S]G(x)\) modulo \(998244353\) corresponding to the same order as the input.
sample
1
1 2
1 998244351