CF1451B-Non-Substring Subsequence
CF1451B-Non-Substring Subsequence
题目:
题目描述:
Hr0d1y has queries on a binary string of length . A binary string is a string containing only characters ‘0’ and ‘1’.
A query is described by a pair of integers , .
For each query, he has to determine whether there exists a good subsequence in that is equal to the substring .
- A substring of a string is the string formed by characters .
- String is said to be a subsequence of string if can be obtained from by deleting some characters without changing the order of the remaining characters.
- A subsequence is said to be good if it is not contiguous and has length . For example, if is “1100110”, then the subsequences (“1100110”) and (“1100110”) are good, while (“1100110”) is not good.
Can you help Hr0d1y answer each query?
输入格式:
The first line of the input contains a single integer ( ) — the number of test cases. The description of each test case is as follows.
The first line contains two integers ( ) and ( ) — the length of the string and the number of queries.
The second line contains the string .
The -th of the next lines contains two integers and ( ).
输出格式:
For each test case, output lines. The -th line of the output of each test case should contain “YES” if there exists a good subsequence equal to the substring , and “NO” otherwise.
You may print each letter in any case (upper or lower).
样例:
样例输入1:
|
|
样例输出1:
|
|
思路:
实现:
|
|
v1.4.14