A physical toggle switch emits a binary trace of length N, represented as s[1], s[2], ..., s[N]. A raw flip occurs at gap i (between s[i] and s[i+1] for $1 \le i < N$) if s[i] != s[i+1].
Due to physical bouncing, the switch uses a debounce window of size g. We scan the gaps from left to right (from gap 1 to N - 1) maintaining a lock counter, which is initially 0. For each gap:
g - 1.Find the number of valid binary traces of length N that result in exactly K registered flips. Since the count can be large, return the answer modulo 998244353.
Input Format
N, denoting the length of the binary trace.K, denoting the exact number of registered flips required.g, denoting the size of the debounce window.Constraints
MotorQ • Pending