#P8557. Alloy Synthesis
Alloy Synthesis
Alloy Synthesis
Bell, a girl who loves gaming, wants to synthesize a rare alloy using n different types of metals. To achieve this, she constructs k different furnaces. When a furnace is activated, it randomly produces a subset (possibly empty) of the n metals. By collecting the metals produced by each furnace, if she ends up having all n metals, she can make the alloy. Your task is to determine how many different outcomes (that is, sequences of furnace outputs) will yield all the metals. Since the answer may be large, output it modulo 998244353.
The number of favorable outcomes is given by the inclusion-exclusion formula:
$$\sum_{i=0}^{n} (-1)^i \binom{n}{i} 2^{(n-i)k} \pmod{998244353}$$
inputFormat
The input consists of one line containing two integers: n and k, where n represents the number of metals, and k is the number of furnaces.
outputFormat
Output a single integer representing the number of ways to obtain all n metals modulo 998244353.
sample
1 1
1