#P12230. Exponential of a Set Power Series
Exponential of a Set Power Series
Exponential of a Set Power Series
We are given a set power series \[ F(x)=\sum_{S\subseteq\{1,2,\dots,n\}}f(S)x^S, \quad\text{with}\quad [x^{\varnothing}]F(x)=0, \] where the monomials are indexed by subsets of \(\{1,2,\dots,n\}\). The multiplication of monomials is defined by the subset convolution: \[ (A*B)(S)=\sum_{T\subseteq S}a_T\,b_{S\setminus T}, \quad\text{for}\quad A(x)=\sum_{S}a_S x^S,\; B(x)=\sum_{S}b_S x^S. \]
Define the exponential of \(F(x)\) by its formal power series expansion \[ e^{F(x)}=\sum_{m\ge0}\frac{F(x)^{*m}}{m!}, \quad\text{with}\quad F(x)^{*0} = \mathbf{1}, \] where \(\mathbf{1}\) is the multiplicative identity (i.e. the series with coefficient 1 for \(x^{\varnothing}\) and 0 elsewhere).
Your task is: given \(f(S)\) for every \(S\subseteq\{1,2,\dots,n\}\) (with \(f(\varnothing)=0\)), compute \([x^S] e^{F(x)}\) modulo \(998244353\) for every subset \(S\).
Hint: By performing the zeta transform (i.e. summing over all submasks) the subset convolution turns into a pointwise product. In fact, if we define \[ H(S)=\sum_{T\subseteq S}f(T), \] then one may show that the zeta transform of the answer \(g(S)=[x^S] e^{F(x)}\) is \[ \hat g(S)=\exp(H(S)). \] Finally, recover \(g(S)\) by performing the Möbius inversion over subsets.
inputFormat
The first line contains an integer \(n\) (with \(1\le n\le20\)). The second line contains \(2^n\) integers representing \(f(S)\) for every \(S\subseteq\{1,2,\dots,n\}\) in order (from \(S=\varnothing\) to \(S=\{1,2,\dots,n\}\)). It is guaranteed that \(f(\varnothing)=0\).
outputFormat
Output \(2^n\) integers in one line separated by spaces, where the \(i\)th number is \([x^S]e^{F(x)}\) mod \(998244353\) for the corresponding subset \(S\) (in the same order as the input).
sample
1
0 1
1 1