NOI '18 P3 - Name
View as PDFYou are given a string , and
queries.
For each query, you are given a string and two integers
,
. You are asked to output the number of distinct substrings of
that is not a substring of
String refers the substring of
from index
to
, i.e.
.
Input Specification
The first line contains an string .
The next line contains an integer .
Each of the next lines contains a string
and two integers
,
.
Output Specification
For each test case, output the answer.
Sample Input
scbamgepe
3
smape 2 7
sbape 3 8
sgepe 1 9
Sample Output
12
10
4
Constraints
| Case | Properties | |||
|---|---|---|---|---|
| None | ||||
| None | ||||
| None | ||||
| None | ||||
| None | ||||
| string is random | ||||
| None | ||||
| String is Random | ||||
| None | ||||
| string is random | ||||
| None | ||||
| string is random | ||||
| None | ||||
| String is random | ||||
| None | ||||
| none | ||||
| none | ||||
| none | ||||
| none | ||||
| none | ||||
| none | ||||
| none |
For the first test points all queries have
.
For all data, it is guaranteed that ,
Comments