AT_abc458_f.Critical Misread
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given K strings Si consisting of lowercase English letters.
Find the number, modulo 998244353, of strings of length N consisting of lowercase English letters that do not contain any of S1,S2,…,SK as a substring (contiguous subsequence).
给你 K 个由小写英文字母组成的字符串 Si。
求长度为 N、由小写英文字母组成的字符串中,不包含 S1,S2,…,SK 中任意一个作为子串(连续子序列)的字符串个数,结果对 998244353 取模。
输入格式
The input is given from Standard Input in the following format:
N K
S1
S2
⋮
SK
输入从标准输入中按以下格式给出:
N K
S1
S2
⋮
SK
输出格式
Output the answer.
输出答案。
输入输出样例
输入#1
3 2 aa ab
输出#1
17474
输入#2
1 1 ab
输出#2
26
输入#3
1000000000 10 contest tester error orange angel elegant antitese sextuple pleasure surely
输出#3
698570468
说明/提示
Sample 1 Explanation:
- The number of strings of length 3 consisting of lowercase English letters is 263=17576.
- The number of strings of length 3 consisting of lowercase English letters whose first two characters are
aais 26. - The number of strings of length 3 consisting of lowercase English letters whose last two characters are
aais 26. - The number of strings of length 3 consisting of lowercase English letters whose first two characters are
abis 26. - The number of strings of length 3 consisting of lowercase English letters whose last two characters are
abis 26. - The number of strings of length 3 consisting of lowercase English letters whose entirety is
aaais 1. - The number of strings of length 3 consisting of lowercase English letters whose entirety is
aabis 1. - Combining the above facts, it can be confirmed that the answer for this test case is 17474.
Sample 3 Explanation:
Find the count modulo 998244353.
Constraints
- N is an integer between 1 and 109, inclusive.
- K is an integer between 1 and 10, inclusive.
- Si is a string consisting of lowercase English letters with length between 1 and 10, inclusive.
样例 1 解释:
- 长度为 3、由小写英文字母组成的字符串总数为 263=17576。
- 长度为 3、由小写英文字母组成且前两个字符为
aa的字符串数量为 26。 - 长度为 3、由小写英文字母组成且后两个字符为
aa的字符串数量为 26。 - 长度为 3、由小写英文字母组成且前两个字符为
ab的字符串数量为 26。 - 长度为 3、由小写英文字母组成且后两个字符为
ab的字符串数量为 26。 - 长度为 3、由小写英文字母组成且整个字符串恰好为
aaa的字符串数量为 1。 - 长度为 3、由小写英文字母组成且整个字符串恰好为
aab的字符串数量为 1。 - 综合以上事实,可确认该测试用例的答案为 17474。
样例 3 解释:
求结果对 998244353 取模的值。
约束条件
- N 是一个介于 1 和 109(含)之间的整数。
- K 是一个介于 1 和 10(含)之间的整数。
- Si 是一个由小写英文字母组成的字符串,其长度介于 1 和 10(含)之间。
输入解题思路,AI测评打分。不知道怎么写?