No.3637 PANDORA
タグ : / 解いたユーザー数 28
作問者 :
kazuppa
/ テスター :
Problem Statement
You are given a string $S$ of length $N$ consisting of lowercase English letters.
A total of $Q$ queries of the following $2$ types will be given. Process them in order.
1 i cUpdate the $i$-th character of $S$ to $c$.2 tAnswer whether $S$ contains $t$ as a subsequence.
Here, when a string $s'$ obtained by deleting $0$ or more characters from a string $s$ matches $t$, we define that $s$ contains $t$ as a subsequence.
Constraints
- $1\leq N,Q\leq 2\times 10^5$
- $S$ is a string of length $N$ consisting of lowercase English letters
- In queries of type $1$, $1\leq i\leq N$
- In queries of type $1$, $c$ is a lowercase English letter
- In queries of type $2$, $t$ is a string of lowercase English letters with length at least $1$ and at most $10$
- Queries of type $2$ are given at least $1$ time
- All numbers given in the input are integers
Subtasks
This problem has partial scoring by subtasks.
| Subtask | Points | Constraints |
|---|---|---|
| Subtask 1 | 5 % | $N=1$ |
| Subtask 2 | 5 % | No queries of type $1$ are given; in queries of type $2$, $|t|=1$ |
| Subtask 3 | 10 % | In queries of type $2$, $|t|=1$ |
| Subtask 4 | 10 % | No queries of type $1$ are given; in queries of type $2$, $|t|=2$ |
| Subtask 5 | 20 % | In queries of type $2$, $|t|=2$ |
| Subtask 6 | 20 % | No queries of type $1$ are given |
| Subtask 7 | 30 % | No additional constraints |
Input
$N\ Q$ $S$ $Query_1$ $Query_2$ $\vdots$ $Query_Q$
Also, $Query$ is given as follows:
$1\ i\ c$
$2\ t$
It is given in one of the above forms.
Output
When query 2 is given $t$ times, print $t$ lines.
On the $i\ (1\leq i\leq t)$-th line, answer the $i$-th given query 2. Print Yes if it is contained, and No if it is not.
Sample
Sample 1
Input
5 5 abcde 2 ac 2 bf 1 3 f 2 ac 2 bf
Output
Yes No No Yes
Before processing the 3rd query, $S=$abcde. At this point, $S$ contains ac as a subsequence but does not contain bf as a subsequence.
After processing the 3rd query, $S=$abfde. At this point, $S$ does not contain ac as a subsequence but contains bf as a subsequence.
Sample 2
Input
7 7 aitsuki 2 aitsuki 2 itsuki 2 azki 1 4 z 2 aitsuki 2 itsuki 2 azki
Output
Yes Yes No No No Yes
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。