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

19334번 - Consistent Occurrences 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 512 MB137292118.584%

문제

Let us define a consistent set of occurrences of string $t$ in string $s$ as a set of occurrences of $t$ in $s$ such that no two occurrences intersect (in other words, no character position in $s$ belongs to two different occurrences).

You are given a string $s$ consisting of $n$ lowercase English letters, and $m$ queries. Each query contains a single string $t_i$.

For each query, print the maximum size of a consistent set of occurrences of $t$ in $s$.

입력

The first line contains two space-separated integers $n$ and $m$: the length of string $s$ and the number of queries (1ドル \le n \le 10^{5},ドル 1ドル \le m \le 10^{5}$).

The second line contains the string $s$ consisting of $n$ lowercase English letters.

Each of the next $m$ lines contains a single string $t_i$ consisting of lowercase English letters: the $i$-th query (1ドル \le |t_i| \le n,ドル where $|t_i|$ is the length of the string $t_i$).

It is guaranteed that the total length of all $t_i$ does not exceed 10ドル^{5}$ characters.

출력

For each query $i,ドル print one integer on a separate line: the maximum size of a consistent set of occurrences of $t_i$ in $s$.

제한

예제 입력 1

6 4
aaaaaa
a
aa
aaa
aaaa

예제 출력 1

6
3
2
1

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 8: Saratov SU Contest K번

Contest > Open Cup > 2017/2018 Season > Stage 13: Grand Prix of Saratov K번

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

출처

대학교 대회

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

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