QOJ.ac

QOJ

时间限制: 1 s 内存限制: 256 MB 总分: 100

#7873. Since A Light

统计

Background

If the music plays again
Leading you and me to fly
I will not fall
I will use all my strength
To hold hands once more and let the whole world resonate
Let us meet again
Feeling your dreams

Luo Tianyi gives you a tree, which initially consists of only a root node. At each time $t$ from $0$ to $n-1$, the following operation occurs:

  • Every node whose depth is congruent to the current time $t$ modulo $2$ grows a leaf node. (The root node has a depth of $0$, and a child node's depth is the parent's depth $+1$).

Find the number of unordered pairs of nodes in the tree at a distance of $d$ after $n$ operations, modulo $998244353$.

Input

A single line containing two integers $n$ and $d$, representing the number of operations and the distance, respectively.

Output

A single line containing an integer $ans$, representing the number of unordered pairs modulo $998244353$.

Examples

Input 1

5 3

Output 1

16

Note 1

img

The unordered pairs are $(1,5)$, $(1,10)$, $(1,11)$, $(1,12)$, $(2,7)$, $(2,8)$, $(3,4)$, $(3,9)$, $(3,11)$, $(3,13)$, $(4,6)$, $(5,6)$, $(6,7)$, $(6,10)$, $(7,9)$, $(8,10)$, for a total of $16$ pairs.

Constraints

For all data: $1\leq n\leq 10^9$, $1\leq d\leq 10^5$.

Subtask 1 (1 pt): $1\leq n\leq 25$, $1\leq d\leq 400$.

Subtask 2 (7 pts): $1\leq n\leq 400$, $1\leq d\leq 400$.

Subtask 3 (10 pts): $1\leq n\leq 2000$, $1\leq d\leq 2000$.

Subtask 4 (14 pts): $1\leq n\leq 5000$, $1\leq d\leq 5000$.

Subtask 5 (19 pts): $1\leq d\leq 100$.

Subtask 6 (36 pts): $1\leq d\leq 5000$.

Subtask 7 (13 pts): No special restrictions.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.