日鉄ソリューションズプログラミングコンテスト2023(AtCoder Beginner Contest 303)
Ex
Constrained Tree Degree
AtCoder
⌀ 2501
原题
←G →
翻译中…

Problem Statement

翻译中…

You are given an integer $N$ and a set $S=\lbrace S_1,S_2,\ldots,S_K\rbrace$ consisting of integers between $1$ and $N-1$.

翻译中…

Find the number, modulo $998244353$, of trees $T$ with $N$ vertices numbered $1$ through $N$ such that:

翻译中…
  • $d_i\in S$ for all $i\ (1\leq i \leq N)$, where $d_i$ is the degree of vertex $i$ in $T$.
翻译中…

Constraints

翻译中…
  • $2\leq N \leq 2\times 10^5$
  • $1\leq K \leq N-1$
  • $1\leq S_1 < S_2 < \ldots < S_K \leq N-1$
  • All values in the input are integers.
翻译中…

Input

翻译中…

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

翻译中…

N K
S_1 \ldots S_K

翻译中…

Output

翻译中…

Print the number, modulo $998244353$, of the conforming trees $T$.

翻译中…

样例

Input #1
4 2
1 3
Output #1
4
A tree satisfies the condition if the degree of one vertex is $3$ and the others' are $1$. Thus, the answer is $4$.
Input #2
10 5
1 2 3 5 6
Output #2
68521950
Input #3
100 5
1 2 3 14 15
Output #3
888770956
Print the count modulo $998244353$.
题目信息

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。