#B. 连通图计数(count)

    Type: RemoteJudge 1000ms 512MiB

连通图计数(count)

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目背景

Ysuperman 模板测试的多项式题。

【数据删除】

题目描述

请问有多少个 nn 个点 mm 条边的无向简单连通图,无自环无重边,满足删掉编号为 ii 的点后无向图被分成了 aia_i 个连通块。特殊地,我们保证 n1mn+1n-1\le m\le n+1,且答案不为 00

答案对 998,244,353998,244,353 取模。

输入格式

第一行两个整数 n,mn,m

第二行 nn 个整数,第 ii 个整数为 aia_i

输出格式

输出一行一个整数,表示答案对 998,244,353998,244,353 取模得到的结果。

4 4
2 1 1 1
3
4 5
1 1 1 1
6
5 6
1 1 2 1 1
27
6 6
1 2 3 1 1 1
30
6 5
2 1 1 1 1 4
4
8 7
1 1 3 1 2 2 2 2
360
8 8
1 1 1 1 2 2 2 2
2520
8 9
1 1 1 1 1 1 2 3
9240
10 11
1 1 1 4 2 2 2 1 1 1
105840
12 13
1 1 1 1 1 1 1 1 1 1 1 1
518269694

提示

样例 1 解释

共有三种可能的图,连的四条边分别为:

  1. (1,2),(1,3),(1,4),(2,3)(1,2),(1,3),(1,4),(2,3)
  2. (1,2),(1,3),(1,4),(2,4)(1,2),(1,3),(1,4),(2,4)
  3. (1,2),(1,3),(1,4),(3,4)(1,2),(1,3),(1,4),(3,4)

数据范围

测试点编号 n,mn,m 特殊性质
141\sim 4 m=n1m=n-1
565\sim 6 m=nm=nn7n\le 7
787\sim 8 m=nm=n ai=1a_i=1
9129\sim 12
131413\sim 14 m=n+1m=n+1n7n\le 7
151615\sim 16 m=n+1m=n+1 ai=1a_i=1
172017\sim 20

对于所有的数据,满足 4n1054\le n\le 10^5n1mn+1n-1\le m\le n+11ai<n1\le a_i<nni=1nai2n2n\le \sum_{i=1}^na_i\le 2n-2,且保证答案非 00

The 2nd Yuzusoft Cup Stage 2: Zhanjiang

Not Attended
Status
Done
Rule
IOI
Problem
6
Start at
2024-3-19 7:30
End at
2024-3-29 7:30
Duration
240 hour(s)
Host
Partic.
10