Logo
(追記) (追記ここまで)

33369번 - Hardcore String Counting 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 2048 MB142240.000%

문제

You are given a non-empty string $s$ of lowercase English letters. A string $w$ of lowercase English letters is good if every proper prefix of $w$ does not contain $s$ as a substring, but $w$ itself does.

Find the number of good strings of length $m$. Because this number can be very large, output it modulo prime number 998ドル,244円,353円 = 2^{23} \cdot 119 + 1$.

입력

The first line of the input contains two integers: $n,ドル the length of $s,ドル and $m,ドル the length of strings you have to count (1ドル \leq n \leq 10^5,ドル $n \leq m \leq 10^9$). The second line contains a string $s$ consisting of $n$ lowercase English letters.

출력

Output a single nonnegative integer: the number of good strings of length $m$ modulo 998ドル,244円,353円$.

제한

예제 입력 1

6 7
aaaaaa

예제 출력 1

25

예제 입력 2

3 5
aba

예제 출력 2

675

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2023 > Day 4: SPb SU Contest, LVII SPb SU Championship M번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /