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) $ :无特殊限制。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.