AT_abc458_f.Critical Misread

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given KK strings SiS_i consisting of lowercase English letters.
Find the number, modulo 998244353998244353, of strings of length NN consisting of lowercase English letters that do not contain any of S1,S2,…,SKS_1, S_2, \dots, S_K as a substring (contiguous subsequence).

给你 KK 个由小写英文字母组成的字符串 SiS_i。
求长度为 NN、由小写英文字母组成的字符串中,不包含 S1,S2,…,SKS_1, S_2, \dots, S_K 中任意一个作为子串(连续子序列)的字符串个数,结果对 998244353998244353 取模。

输入格式

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

NN KK
S1S_1
S2S_2
⋮\vdots
SKS_K

输入从标准输入中按以下格式给出:

NN KK
S1S_1
S2S_2
⋮\vdots
SKS_K

输出格式

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 33 consisting of lowercase English letters is 263=1757626^3=17576.
  • The number of strings of length 33 consisting of lowercase English letters whose first two characters are aa is 2626.
  • The number of strings of length 33 consisting of lowercase English letters whose last two characters are aa is 2626.
  • The number of strings of length 33 consisting of lowercase English letters whose first two characters are ab is 2626.
  • The number of strings of length 33 consisting of lowercase English letters whose last two characters are ab is 2626.
  • The number of strings of length 33 consisting of lowercase English letters whose entirety is aaa is 11.
  • The number of strings of length 33 consisting of lowercase English letters whose entirety is aab is 11.
  • Combining the above facts, it can be confirmed that the answer for this test case is 1747417474.

Sample 3 Explanation:
Find the count modulo 998244353998244353.

Constraints

  • NN is an integer between 11 and 10910^9, inclusive.
  • KK is an integer between 11 and 1010, inclusive.
  • SiS_i is a string consisting of lowercase English letters with length between 11 and 1010, inclusive.

样例 1 解释:

  • 长度为 33、由小写英文字母组成的字符串总数为 263=1757626^3 = 17576。
  • 长度为 33、由小写英文字母组成且前两个字符为 aa 的字符串数量为 2626。
  • 长度为 33、由小写英文字母组成且后两个字符为 aa 的字符串数量为 2626。
  • 长度为 33、由小写英文字母组成且前两个字符为 ab 的字符串数量为 2626。
  • 长度为 33、由小写英文字母组成且后两个字符为 ab 的字符串数量为 2626。
  • 长度为 33、由小写英文字母组成且整个字符串恰好为 aaa 的字符串数量为 11。
  • 长度为 33、由小写英文字母组成且整个字符串恰好为 aab 的字符串数量为 11。
  • 综合以上事实,可确认该测试用例的答案为 1747417474。

样例 3 解释:
求结果对 998244353998244353 取模的值。

约束条件

  • NN 是一个介于 11 和 10910^9(含)之间的整数。
  • KK 是一个介于 11 和 1010(含)之间的整数。
  • SiS_i 是一个由小写英文字母组成的字符串,其长度介于 11 和 1010(含)之间。

输入解题思路,AI测评打分。不知道怎么写?

首页