#abc253e. E - Distance Sequence

    ID: 3656 传统题 1000ms 256MiB 尝试: 70 已通过: 12 难度: 8 上传者: 标签>来源atcoder动态规划基础算法前缀和与差分前缀和

E - Distance Sequence

Score : 500500 points

问题描述

有多少个长度为 NN 的整数序列 A=(A1,,AN)A=(A_1,\ldots,A_N) 满足以下所有条件?

  • 1AiM1\le A_i \le M (1iN)(1 \le i \le N)

  • AiAi+1K|A_i - A_{i+1}| \geq K (1iN1)(1 \le i \le N - 1)

由于满足条件的序列数量可能非常庞大,因此请在模 998244353998244353 下计算该数量。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

How many integer sequences A=(A1,,AN)A=(A_1,\ldots,A_N) of length NN satisfy all the conditions below?

  • 1AiM1\le A_i \le M (1iN)(1 \le i \le N)

  • AiAi+1K|A_i - A_{i+1}| \geq K (1iN1)(1 \le i \le N - 1)

Since the count can be enormous, find it modulo 998244353998244353.

Constraints

  • 2N10002 \leq N \leq 1000
  • 1M50001 \leq M \leq 5000
  • 0KM10 \leq K \leq M-1
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM KK

Output

Print the count modulo 998244353998244353.

Sample Input 1

2 3 1

Sample Output 1

6

The following 66 sequences satisfy the conditions.

  • (1,2)(1,2)
  • (1,3)(1,3)
  • (2,1)(2,1)
  • (2,3)(2,3)
  • (3,1)(3,1)
  • (3,2)(3,2)

Sample Input 2

3 3 2

Sample Output 2

2

The following 22 sequences satisfy the conditions.

  • (1,3,1)(1,3,1)
  • (3,1,3)(3,1,3)

Sample Input 3

100 1000 500

Sample Output 3

657064711

Print the count modulo 998244353998244353.

update @ 2024/3/10 10:47:45