No.3215 Make K types-able
Credit
This problem is a partially modified version of an original idea provided by kobaryu325.
Problem Statement
In this problem, an array whose elements are each $0$ or $1$ is called a 01 array.
You are given positive integers $N,K$. Find the number of 01 arrays $X=(X_1,X_2,\dots , X_{2^N-1})$ of length $2^N -1$ satisfying the following condition.
- Consider an array $a$ of length $N$, initially $a_1 = 1,a_i = -1\ (2\le i\le N)$. After performing the following operations $0$ or more times, the number of distinct possible values of $a_N$ is exactly $K$.
- Choose one $x$ such that $a_x \neq -1$ , $X_{a_x} = 1$ , $X_{2a_x} = 1$, and replace $a_{x+1}$ with $2a_x$.
- Choose one $x$ such that $a_x \neq -1$ , $X_{a_x} = 1$ , $X_{2a_x+1} = 1$, and replace $a_{x+1}$ with $2a_x+1$.
Since the answer can be extremely large, find the answer modulo $998244353$.
Solve each of the $T$ test cases.
Input
$T$
$\mathrm{case}_1$
$\mathrm{case}_2$
$\vdots$
$\mathrm{case}_T$
Each test case is given in the following format.
$N\ K$
Constraints
- $1\le T\le 2\times 10^5$
- $2\le N \le 2\times 10^5$
- $1\le K \le $ $10$
- $N,K$ are integers.
Output
Output $T$ lines. On the $i$-th line, output the answer for the $i$-th test case modulo $998244353$.
Print a newline at the end.Sample
Sample 1
Input
2 2 2 100 10
Output
2 95769305
For the $1$st test case, the arrays satisfying the condition are the $2$ arrays $(1,0,1),(1,1,0)$.
Consider $X=(1,0,1)$. The possible arrays $a$ after the operations are the following $2$.
- Perform no operation. In this case, $a_N=a_2=-1$.
- Perform the second operation exactly once with $x=1$, making $a=(1,3)$. In particular, $a_N=a_2=3$.
Therefore, there are $2$ distinct possible integers for $a_N$ after the operations, so this $X$ satisfies the condition.
On the other hand, $X=(1,1,1)$ does not satisfy the condition, since $a_N$ can take $3$ distinct integers $-1,2,3$ after the operations.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
Cafe1942