区间查找查询AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)You are given strings $S$ and $T$.
Process $Q$ queries.
In each query, you are given $L$ and $R$. Determine whether the substring of $S$ consisting of the $L$-th through $R$-th characters contains $T$ as a substring.
给定字符串 $S$ 和 $T$。
请处理 $Q$ 次查询。
每次查询给定 $L$ 和 $R$。判断由 $S$ 的第 $L$ 个字符到第 $R$ 个字符组成的子串是否包含 $T$ 作为子串。AI (CI翻译)
What is a substring? A substring of $S$ is a string obtained by deleting zero or more characters from the beginning and zero or more characters from the end of $S$. For example, ab is a substring of abc, but ac is not a substring of abc.
什么是子串?$S$ 的一个子串是指从 $S$ 的开头删除零个或多个字符,再从末尾删除零个或多个字符后得到的字符串。例如,ab 是 abc 的子串,但 ac 不是 abc 的子串。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$S$is a string of length between$1$and$4 \times 10^5$, inclusive, consisting of lowercase English letters.$T$is a string of length between$1$and$10$, inclusive, consisting of lowercase English letters.$1 \leq Q \leq 2 \times 10^5$$1 \leq L \leq R \leq |S|$$Q, L, R$are integers.
$S$是一个长度在$1$到$4 \times 10^5$之间(含两端)、仅由小写英文字母组成的字符串。$T$是一个长度在$1$到$10$之间(含两端)、仅由小写英文字母组成的字符串。$1 \leq Q \leq 2 \times 10^5$$1 \leq L \leq R \leq |S|$$Q, L, R$均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入通过标准输入以如下格式给出:AI (CI翻译)
Q
S
T
\mathrm{query}_1
\mathrm{query}_2
\vdots
\mathrm{query}_Q
Q
S
T
\mathrm{query}_1
\mathrm{query}_2
\vdots
\mathrm{query}_QAI (CI翻译)
Each query $\mathrm{query}_q$ is given in the following format:
每次查询 $\mathrm{query}_q$ 以如下格式给出:AI (CI翻译)
L R
L RAI (CI翻译)
Output
输出格式
AI (CI翻译)Output $Q$ lines. The $q$-th line should contain Yes if, for the $q$-th query, the substring of $S$ consisting of the $L$-th through $R$-th characters contains $T$ as a substring, and No otherwise.
输出 $Q$ 行。对于第 $q$ 次查询,如果由 $S$ 的第 $L$ 个字符到第 $R$ 个字符组成的子串包含 $T$ 作为子串,则在第 $q$ 行输出 Yes,否则输出 No。AI (CI翻译)
样例
3
abcdabc
bc
2 6
3 5
3 7
Yes
No
Yes
10
bbbaaabbbaaaaaabbbab
bbb
5 16
5 6
2 16
6 7
17 19
3 7
7 16
7 20
17 19
2 6
Yes
No
Yes
No
No
No
Yes
Yes
No
No
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。