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

19132번 - Substring Query 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 512 MB114391934.545%

문제

Bobo has $n$ strings $S_1, S_2, \dots, S_n$. One day, his friend yiyi comes and asks him $q$ questions: how many strings in $S_{l_i}, S_{l_i + 1}, \dots, S_{r_i}$ containing $P_i$ as a substring?

Help bobo find out the answer.

입력

The first line contains 2ドル$ integers $n, q$ (1ドル \leq n, q \leq 200000$).

Each of the following $n$ lines contains 1ドル$ string $S_i$ ($|S_1| + |S_2| + \dots + |S_n| \leq 200000$).

Each of the last $q$ lines contains 2ドル$ integers $l_i, r_i$ and 1ドル$ string $P_i$.

(1ドル \leq l_i \leq r_i \leq n, |P_1| + |P_2| + \dots + |P_n| \leq 200000$)

All strings consist of "a" and "b".

출력

For each question, a single integer denotes the answer.

제한

예제 입력 1

4 2
a
b
ab
bab
1 3 a
1 4 ab

예제 출력 1

2
2

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2015 > Day 1: Xiaoxu Guo Contest 3 I번

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

출처

대학교 대회

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

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