QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#13339. 你將如閃電般歸來

الإحصائيات

在第三個遊戲中贏下了小 L 後,跳跳將軍放你離開了跳跳堡。

而在長時間圍困跳跳堡後,跳蚤國王指揮部隊發動了總攻。雙方交戰異常激烈,最終你立下了大功,利用潛入跳跳堡時得到的地圖發現了突破口——一座無人防守的小門,於是潮水般的跳蚤和蛐蛐湧進了小門,跳蚤蛐蛐聯軍終於成功收復了跳跳堡,恢復了跳蚤國。

在慶功宴上,跳蚤樂隊奏響了新譜的歌曲《你將如閃電般歸來》,跳蚤國王心情大好,給在場的賓客們出了一個題,只要能做出這個題就可以獲得他的大賞:

給定一棵節點被染有紅色或綠色的有標號有根樹,我們稱之為「閃電樹」當且僅當:

  1. 每個節點 $i$ 的父親編號 $p_i$ 比 $i$ 小,即 $p_i < i$;
  2. 這棵樹的每一層恰有一個紅色節點;
  3. 對於任意一個節點,如果它不是根節點,那麼它的父親一定是紅色;
  4. 任意一個紅色節點的綠色孩子數量均為偶數個。

「可以推出,閃電樹中紅色的節點形成了一條從根節點往下連到某個葉子節點的紅色路徑,就像一條紅色的閃電,劃開前方的艱難險阻……」跳蚤國王形象地描述道。

給定 $k, n$,問節點數為 $n$ 層數為 $k$ 的閃電樹的數量對 $998244353$ 取模的值。

這道題非常難,在場的其他賓客絞盡腦汁也不知道怎麼完成,但你——伏特是一名計算機高手,發現這個題目可以用計算機輕鬆解決。只要解決了它,大賞就是你的了!

輸入格式

一行兩個正整數 $k,n$,表示樹的層數和結點數。

輸出格式

一行一個整數表示答案對 $998244353$ 取模的值。

範例

範例 1

輸入

2 10

輸出

9

說明 容易發現樹的形態一定只能是 $p_2=p_3=\ldots=p_{10}=1$,即第一層為節點 $1$,第二層為節點 $2\sim 10$。

而對於樹的顏色,顯然節點 $1$ 只能是紅色,節點 $2\sim 10$ 中恰好有一個是紅色,其餘是綠色,因此共有 $9$ 種方案。

範例 2

輸入

3 7

輸出

65

範例 3

輸入

8 14

輸出

703179

範例 4

輸入

529 1453

輸出

159030840

範例 5

輸入

1453 14530529

輸出

443513052

範例 6

輸入

10 1000000000000000000

輸出

384797525

資料範圍

對於所有資料,$1\le k\le 10^7$,$k\le n\le 10^{18}$,$k\equiv n \pmod 2$。

子任務編號 $k\le$ $n\le$ 分值
$1$ $n$ $100$ $15$
$2$ $3\times 10^3$ $10$
$3$ $10^5$ $15$
$4$ $10^7$ $10$
$5$ $3$ $10^{18}$ $5$
$6$ $100$ $15$
$7$ $10^3$ $15$
$8$ $10^7$ $15$

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.