Orange Boy Can You Solve It Out? Ep. 35

思考题 for 2020

DuiLian

二十年飞花不尽
一几度落月无穷
九州同乐
Of twenty years, the flower never withers
In one eternity, the moon forever remains
Enjoy it together

It's 2020 soon. It's time for the biggest holiday - The Yuandan and the Chinese New Year is coming!
Orange Boy is writing DuiLian(对联) for the 2020 Chinese New Year. He wrote a ShangLian(上联) and was going to write XiaLian(下联).
In Chinese DuiLian, it's important for us to match the rhythm and property of the words. For example "飞花"(flying flower) can match "落月"(falling moon) because they are all noun and match the rhythm.
Now the OB has determined some of the words, while blanking the others. He knows how many spaces has been left for each space.
Red Girl has thought a XiaLian for him. Now OB has Q queries, in each query he wants to change some space numbers and ask you whether Red Girl's XiaLian matches the requirements.
Formally, you are given a model string T. T contains characters and wildcard matcher ''. It is known that the i-th matcher should match A[i] characters. In each query, a single A[i] is changed. For each query, you need to print whether a given string S matches the model string T.
For example, T=aa*bb and S=aaccbb matches when A={2} (
=cc)
T=aa*bb and S=aaccbb don't match when A={1}
T=aa*bb and S=aacdbc don't match when A={1} or A={2}
Note: use UTF-8 input

Examples

T=一几度**
A={2,2}
S=一几度落月无穷
Q={A_1=3,A_2=1,A_1=2,A_2=2}
Output
NO
YES
NO
YES
Explain
After query 2, the string can be matched as: 一几度(落月无)(穷)
After query 4, the string can be matched as: 一几度(落月)(无穷)

Constriants

Subtask 1(30%):1<=|S|,|T|,q<=1000
Subtask 2(30%):S and T contains character "甲乙丙丁戊己庚辛壬癸子丑寅卯辰巳午未申酉戌亥"(22) only
Subtask 3(40%):1<=|S|,|T|,q<=100000 S,T contains all possible Chinese characters.

Happy New Year in 2020!

版权声明:
作者:XGN
链接:https://blog.hellholestudios.top/archives/341
来源:Hell Hole Studios Blog
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>