QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 512 MB 満点: 100 難易度: [表示]

#1816. 多重括號

統計

考慮由括號 '(' 和 ')' 組成的字串。 正規括號序列(regular bracket sequence)是透過以下規則所定義的字串:

  • 空字串是正規括號序列。
  • 若 $A$ 是正規括號序列,則 $(A)$ 也是正規括號序列。
  • 若 $A$ 和 $B$ 都是正規括號序列,則 $A$ 與 $B$ 的串接也是正規括號序列。

你有 $N$ 個編號為 $1, 2, \dots, N$ 的盒子,以及兩個整數 $M$ 和 $K$。你的任務是在每個盒子中放入恰好一個正規括號序列,使得滿足以下條件:

  • 所有 $N$ 個盒子中 '(' 括號的總數等於 $M$。
  • 長度為 $2 \cdot K$ 的正規括號序列不能放入盒子中。

請計算滿足上述條件的不同分配方式數量。若存在一個編號 $i$ 使得在兩種分配方式中,第 $i$ 個盒子所包含的正規括號序列不同,則視為不同的分配方式。 由於答案可能非常大,請輸出答案對 $998\,244\,353$ 取模後的結果。

輸入格式

輸入包含一行,其中有三個整數 $N, M, K$ ($1 \le M, N \le 10^6, 1 \le K \le M$)。

輸出格式

輸出答案對 $998\,244\,353$ 取模後的結果。

範例

輸入 1

2 2 1

輸出 1

4

輸入 2

1 1 1

輸出 2

0

輸入 3

24 120 30

輸出 3

379268651

說明

對於第一個範例,以下分配方式滿足條件:

  • $(())$, empty;
  • $()()$, empty;
  • empty, $(())$;
  • empty, $()()$。

因此,答案為 $4$。

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.