atcoder#ARC156E. [ARC156E] Non-Adjacent Matching

[ARC156E] Non-Adjacent Matching

Score : 800800 points

Problem Statement

Find the number, modulo 998244353998244353, of good sequences of length NN whose elements are integers between 00 and MM, inclusive, and whose sum is at most KK.

Here, a length-NN sequence X=(X1,X2,,XN)X=(X_1,X_2,\ldots,X_N) is said to be good if and only if there is a graph GG that satisfies all of the following conditions.

  • GG is a graph with NN vertices numbered 11 to NN without self-loops. (It may have multi-edges.)
  • For each i (1iN)i\ (1\leq i \leq N), the degree of vertex ii is XiX_i.
  • For each i (1iN)i\ (1\leq i \leq N), no edge connects vertex ii and vertex i+1i+1. Here, vertex N+1N+1 means vertex 11.

Constraints

  • 4N30004 \leq N \leq 3000
  • 0M30000 \leq M \leq 3000
  • 0KNM0\leq K \leq NM
  • All numbers in the input are integers.

Input

The input is given from Standard Input in the following format:

NN MM KK

Output

Print the answer.

4 1 2
3

The following three sequences are good.

  • (0,0,0,0)(0,0,0,0)
  • (0,1,0,1)(0,1,0,1)
  • (1,0,1,0)(1,0,1,0)
10 0 0
1
314 159 26535
248950743

Print the count modulo 998244353998244353.