#P7879. 「SWTR-7」How to AK NOI?
「SWTR-7」How to AK NOI?
Background
Some definitions and conventions about strings are explained in the “Help / Hint” section.
Please do not maliciously exploit the judge.
Xiao A is reading an article — “How to AK NOI Elegantly?”.
Problem Description
Unfortunately, this article is written in English. Xiao A has very poor eyesight, and his vocabulary is also very small.
Specifically, this article can be represented by a string . Another string is given: every word that Xiao A knows is a substring of with length at least .
A text segment is called “readable” if and only if it can be split into several words that Xiao A can understand. For example, when and , and are readable, while and are not readable.
Next, Xiao A will perform actions:
- Type 1: Rub his eyes. Specifically, Xiao A chooses a substring of the article and modifies it into a string .
- Type 2: Read the article. Specifically, Xiao A chooses a substring of the article and reads it. For each Type 2 operation, you need to tell Xiao A whether he can understand this text segment. If he can understand it, output
Yes; otherwise outputNo.
Input Format
The first line contains a positive integer , indicating the Subtask ID for this test point.
The second line contains a string .
The third line contains a string .
The fourth line contains a positive integer .
The fifth line contains a positive integer .
The next lines each describe one query. First, an operation parameter is given:
- If , then two positive integers and a string follow, meaning to modify into .
- If , then two positive integers follow, meaning one query.
Output Format
For each query, output one line:
if it is readable, output Yes; otherwise output No.
0
bbccabcacbcbac
cbcacbcabbcabca
3
17
2 1 2
2 1 4
2 1 6
2 2 15
2 6 15
2 9 15
1 4 13 babbccabbd
2 1 11
2 1 12
2 1 15
2 5 11
1 13 15 cab
2 3 12
2 7 10
2 11 15
2 10 14
2 9 14
No
No
Yes
Yes
Yes
Yes
Yes
No
No
No
No
Yes
No
No
Yes
Hint
“Constraints and Conventions”
Let , , .
| Subtask | Score | |||||
|---|---|---|---|---|---|---|
| 0 | 0 point | |||||
| 1 | 10 points | |||||
| 2 | ||||||
| 3 | ||||||
| 4 | ||||||
| 5 | 15 points | |||||
| 6 | 10 points | |||||
| 7 | 15 points | |||||
| 8 | 20 points | |||||
For of the data: , , , , . It is guaranteed that , and the character set is .
Subtask 0 contains the sample and Hack testdata.
- Subtask 0 ~ 3: time limit 1s.
- Subtask 4 ~ 6: time limit 1.5s.
- Subtask 7: time limit 3s.
- Subtask 8: time limit 4.5s.
“Subtask Dependencies”
This problem uses subtask dependencies.
Simply put, if Subtask a depends on Subtask b, then Subtask a will be counted toward the total score only when you pass all test points of Subtask b.
- Subtask 1 depends on Subtask 0.
- Subtask 2 depends on Subtask 0,1.
- Subtask 3 depends on Subtask 0,1,2.
- Subtask 6 depends on Subtask 0,5.
- Subtask 7 depends on Subtask 0,5,6.
- Subtask 8 depends on Subtask 0~7.
It is guaranteed that the Hack testdata of Subtask 0 satisfies all constraints of Subtask 1,2,3,6,7,8.
“Help / Hint”
A string is a substring of if and only if we can delete some characters (possibly none) from the beginning and the end of and obtain .
Define as the string formed by .
The input file is large, so please pay attention to IO optimization.
“Source”
Sweet Round 07 E.
idea & solution & data: Alex_Wei; problem checking: tzc_wk.
Translated by ChatGPT 5