問題一覧 > 通常問題

No.3215 Make K types-able

レベル : / AI推定難易度 : 1925 / 実行時間制限 : 1ケース 4.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 29
作問者 : yuusaan / テスター : lif4635 👑 loop0919 Cafe1942
お気に入りにしたユーザー ProblemId : 12535 / 自分の提出
問題文最終更新日: 2025-07-25 21:11:16
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 475 (ゆるCafe) (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。