Type: Default File IO: table 4000ms 1024MiB

数字表格

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.

数字表格(table\texttt{table}

【题目描述】

露娜有一个 mm 行的表格,第 ii 行有 aia_i 个空位,她要用这个表格和朝日做游戏。

朝日有 nn 个数字串 S1,SnS_1,\sim S_n,第 jj 次操作朝日会把 SjS_j 等概率地插到当前没被占用的空位里。

若某个行 ii 被填满,则游戏立刻结束,游戏的价值为这 aia_i 个格子上填的数字串从左往右顺次拼接形成的十进制数。

为了防止 nn 个数字串全部插入后游戏还没结束,露娜保证了 (i=mnai)m+1n(\sum_{i=m}^na_i)-m+1\le n

露娜想知道这个游戏求最终价值的期望,答案对 998244353998244353 取模。

【输入格式】

table.in\texttt{table.in} 中读入数据。

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

第二行 mm 个整数 a1,a2,,ama_1,a_2,\dots,a_m

接下来 nn 行每行一个由 090\sim 9 组成的字符串表示 SiS_i(可能有前导 00)。

【输出格式】

输出到 table.out\texttt{table.out} 中。

一行一个整数,表示答案的期望对 998244353998244353 取模后的结果。

【样例 1 输入】

2 2
1 2
1
23

【样例 1 输出】

67

【样例 2 输入】

3 3
1 2 2
10
21
32

【样例 2 输出】

33275775

【数据范围】

对于所有测试数据:n,m,Si600,ai1,i=1mai<n+mn,m,|S_i|\le 600,a_i\ge 1,\sum_{i=1}^ma_i<n+m

NOIP 题目选讲

Not Attended
Status
Done
Rule
IOI
Problem
7
Start at
2023-11-4 12:00
End at
2023-11-9 12:00
Duration
120 hour(s)
Host
Partic.
29