#P7265. Graph Component k-th Order Averages
Graph Component k-th Order Averages
Graph Component k-th Order Averages
Mivik mistakenly computed \((x+y)^2\) as \(x^2+y^2\) and, inspired by the drifting and merging clouds in the sky, defined a k-th order average for a sequence \(S\) as follows:
\[ avg_k(S)=\frac{\sum_{i=1}^{|S|}S_i^k}{\Big(\sum_{i=1}^{|S|}S_i\Big)^k} \]
Recalling the important events of 2020 – organizing his first contest, witnessing Porter Robinson return to music, meeting that special someone, etc. – there were exactly \(n\) events. Some of these events are connected to each other; that is, they form an undirected graph. Mivik writes down the sizes of all maximal connected components of this graph on a sheet of paper, believing that they together represent all he experienced in 2020.
Before sending his paper airplane off, Mivik wishes to compute the k-th order average of the numbers on that paper (i.e. the connected component sizes). However, he has forgotten the exact connectivity between events. So he asks you to consider all possible undirected graphs on \(n\) vertices (two graphs are considered different if and only if there exist two events that are connected in one graph but not in the other) and, for every \(k\) in \([0, K]\), compute:
\[ \sum_{G\in S(n)}\frac{\sum_{i=1}^{|f(G)|}f(G)_i^k}{\Big(\sum_{i=1}^{|f(G)|}f(G)_i\Big)^k} \]
where \(f(G)\) denotes the sequence of sizes of the maximal connected components of \(G\), and \(S(n)\) is the set of all undirected graphs on \(n\) vertices. Note that since the sum of the component sizes is always \(n\), the expression simplifies to
\[ \frac{1}{n^k}\sum_{G\in S(n)}\sum_{i=1}^{|f(G)|}f(G)_i^k. \]
Output your answers modulo 998244353. (If you are not sure how to perform a division in modular arithmetic, please refer to the relevant literature.)
inputFormat
The input consists of a single line containing two integers \(n\) and \(K\) \((1\leq n\leq \text{small},\, 0\leq K\leq \text{small})\), representing the number of events and the maximum exponent respectively.
outputFormat
Output \(K+1\) integers separated by a space. The \(i\)-th number (0-indexed) is the sum over all undirected graphs on \(n\) vertices of the k-th order average (with \(k=i\)) as defined above, taken modulo 998244353.
sample
1 0
1