/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 333 点
問題文
高橋君は秘密クラブの受付係をしています。クラブに入るためには、メンバーが送るメッセージの中に正しい合言葉が隠されている必要があります。
今日は N 人がクラブへの入場を希望しており、それぞれ 1 つずつメッセージを送ってきました。 i 番目の人のメッセージは英小文字からなる文字列 S_i です。
クラブの合言葉は sayounara です。文字列 S_i が部分列として sayounara を含んでいれば、その人物は正しい合言葉を知っているとみなし、入場を許可します。
ここで、文字列 T が文字列 S の部分列であるとは、 S から 0 文字以上の文字を取り除き、残った文字を元の順序のまま連結すると T が得られることを意味します。(取り除く文字は連続していなくてもかまいません。)
N 人のメッセージそれぞれについて、合言葉が含まれているかどうかを判定してください。
制約
- 1 \leq N \leq 2 \times 10^5
- 1 \leq |S_i| \leq 5 \times 10^6
- S_i は英小文字からなる文字列
- \displaystyle\sum_{i=1}^{N} |S_i| \leq 5 \times 10^6
入力
N S_1 S_2 \vdots S_N
- 1 行目には、入場希望者の人数を表す整数 N が与えられる。
- 続く N 行のうち i 行目 (1 \leq i \leq N) には、 i 番目の入場希望者のメッセージである英小文字からなる文字列 S_i が与えられる。
出力
N 行出力せよ。 i 行目 (1 \leq i \leq N) には、 S_i が部分列として sayounara を含むならば Yes を、含まないならば No を出力せよ。
入力例 1
3 sayounara xsxaxxyxouxnxaxrxa sayounarasayounara
出力例 1
Yes Yes Yes
入力例 2
4 sayonara aranouyas hello saaayyyy
出力例 2
No No No No
入力例 3
6 sayounara abcdsaefgayhibjkoulmnnopaaqrsata sayonara ssssaaaayyyyoooouuuunnnnaaarrrraaaa souynara aaaaaaaaasaaaaaaaaayaaaaaaaaaaoaaaaaaaaaaauaaaaaaaaaanaaaaaaaaaaaaaaaaaaaaaaraaaaaaaaaa
出力例 3
Yes Yes No Yes No Yes
入力例 4
10 sayounara abcdefghijklmnopqrstuvwxyz saeiyounotaruaze thisisasayounaramessage saayyyooouuunnnaarrraaa aaaaranuoyas ssayyoouunnaarraa sxaxyzoyounbara saaaaaaaayoooounaaaaara ra
出力例 4
Yes No Yes Yes Yes No Yes Yes Yes No
入力例 5
1 a
出力例 5
No
Score : 333 pts
Problem Statement
Takahashi is working as a receptionist for a secret club. To enter the club, a member's message must contain the correct password hidden within it.
Today, N people wish to enter the club, and each of them has sent one message. The message from the i-th person is a string S_i consisting of lowercase English letters.
The club's password is sayounara. If the string S_i contains sayounara as a subsequence, that person is considered to know the correct password and is permitted to enter.
Here, a string T is a subsequence of a string S means that by removing zero or more characters from S and concatenating the remaining characters in their original order, we obtain T. (The removed characters do not need to be contiguous.)
For each of the N messages, determine whether it contains the password.
Constraints
- 1 \leq N \leq 2 \times 10^5
- 1 \leq |S_i| \leq 5 \times 10^6
- S_i is a string consisting of lowercase English letters
- \displaystyle\sum_{i=1}^{N} |S_i| \leq 5 \times 10^6
Input
N S_1 S_2 \vdots S_N
- The first line contains an integer N representing the number of people wishing to enter.
- Over the following N lines, the i-th line (1 \leq i \leq N) contains a string S_i consisting of lowercase English letters, which is the message from the i-th person.
Output
Print N lines. On the i-th line (1 \leq i \leq N), print Yes if S_i contains sayounara as a subsequence, and No otherwise.
Sample Input 1
3 sayounara xsxaxxyxouxnxaxrxa sayounarasayounara
Sample Output 1
Yes Yes Yes
Sample Input 2
4 sayonara aranouyas hello saaayyyy
Sample Output 2
No No No No
Sample Input 3
6 sayounara abcdsaefgayhibjkoulmnnopaaqrsata sayonara ssssaaaayyyyoooouuuunnnnaaarrrraaaa souynara aaaaaaaaasaaaaaaaaayaaaaaaaaaaoaaaaaaaaaaauaaaaaaaaaanaaaaaaaaaaaaaaaaaaaaaaraaaaaaaaaa
Sample Output 3
Yes Yes No Yes No Yes
Sample Input 4
10 sayounara abcdefghijklmnopqrstuvwxyz saeiyounotaruaze thisisasayounaramessage saayyyooouuunnnaarrraaa aaaaranuoyas ssayyoouunnaarraa sxaxyzoyounbara saaaaaaaayoooounaaaaara ra
Sample Output 4
Yes No Yes Yes Yes No Yes Yes Yes No
Sample Input 5
1 a
Sample Output 5
No