201564: [AtCoder]ARC156 E - Non-Adjacent Matching

Memory Limit:1024 MB Time Limit:4 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $800$ points

Problem Statement

Find the number, modulo $998244353$, of good sequences of length $N$ whose elements are integers between $0$ and $M$, inclusive, and whose sum is at most $K$.

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

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

Constraints

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

Input

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

$N$ $M$ $K$

Output

Print the answer.


Sample Input 1

4 1 2

Sample Output 1

3

The following three sequences are good.

  • $(0,0,0,0)$
  • $(0,1,0,1)$
  • $(1,0,1,0)$

Sample Input 2

10 0 0

Sample Output 2

1

Sample Input 3

314 159 26535

Sample Output 3

248950743

Print the count modulo $998244353$.

Input

题意翻译

定义一个长度为 $n$ 的序列 $X$ 是合法的,当且仅当存在一个无向图 $G$ 满足: - $G$ 无自环(但可能有重边)。 - 对于所有 $1\le i\le n$,点 $i$ 的度数是 $X_i$。 - 对于所有的 $1\le i\le n$,不存在连接 $i$ 和 $i+1$ 的边。这里认为 $n+1$ 是 $1$。 求长度为 $n$,序列值域为 $[0,m]$,且序列的和小于等于 $k$ 的合法序列的个数,对 $998244353$ 取模。 $4\le n\le 3000,m\le 3000,k\le nm$

加入题单

算法标签: