QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 512 MB 總分: 100 难度: [顯示]

#1816. 多重括弧

统计

‘(’ と ‘)’ のみからなる文字列を考える。 正しい括弧列(regular bracket sequence)とは、以下の規則によって得られる文字列のことである。

  • 空文字列は正しい括弧列である。
  • $A$ が正しい括弧列であるならば、$(A)$ も正しい括弧列である。
  • $A$ と $B$ が正しい括弧列であるならば、それらを連結した $AB$ も正しい括弧列である。

$1, 2, \dots, N$ と番号付けられた $N$ 個の箱と、2つの整数 $M$ および $K$ が与えられる。各箱にちょうど1つずつ正しい括弧列を入れ、以下の条件を満たすようにせよ。

  • $N$ 個の箱すべてに含まれる ‘(’ の総数が $M$ に等しいこと。
  • 長さが $2 \cdot K$ である正しい括弧列を箱に入れてはならない。

このような入れ方の総数を求めよ。ある箱 $i$ について、その箱に入っている正しい括弧列が異なる場合、それらの分布は異なるとみなす。 答えは非常に大きくなる可能性があるため、998 244 353 で割った余りを出力せよ。

入力

入力は1行で、3つの整数 $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

注記

最初の例において、以下の分布が条件を満たす。

  • $(())$, 空
  • $()()$, 空
  • 空, $(())$
  • 空, $()()$

したがって、答えは 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.