QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#7873. Since A Light

统计

题目背景

若音乐再响起
带领你我飞翔
我不会坠落
我会用尽所有力量
再一次手牵着手握紧让全世界共鸣
让我们再相遇
感受到你的梦想

题目描述

洛天依给了你一棵树,树初始只有一个根节点。 在时刻 $ 0 $ 到 $ n-1 $,每个时刻会发生一次以下的操作:

  • 所有深度与当前时刻 $ t $ 模 $ 2 $ 同余的点长出一个叶子。(根节点深度为 $ 0 $,儿子节点的深度为父亲节点的深度 $ +1 $)。

求 $ n $ 次操作后树上距离为 $ d $ 的无序点对的数量,对 $ 998244353 $ 取模。

输入格式

一行两个整数 $ n,d $,分别表示操作次数和距离。

输出格式

一行一个整数 $ ans $,表示无序点对数模 $ 998244353 $ 后的结果。

样例

输入 #1

5 3

输出 #1

16

样例解释

img

无序点对分别为 $ (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) $,一共 $ 16 $ 个。

数据范围

对于所有数据:$ 1\leq n\leq 10^9 $,$ 1\leq d\leq 10^5 $。

$ Subtask $ $ 1\ (1 \ pts) $ :$ 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) $ :无特殊限制。

Discussions

About Discussions

The discussion section is only for posting: Editorials, 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. Submitting multiple issues may cause your account to be banned.
  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.