Orange Boy Can You Solve It Out? Ep. 49

思考题 so easy just to prove I am not dead

ESL

Wulpit is a divine fox spirit. She is learning Chinese. So she doesn't understand English.

One day she received an English string S of n lower case characters. XGN told her how her name would be like in English - T. Let's say that a sequence of characters x is Relevant if:
- x is a subtring of S
- the number of suffixes of x whose prefix is T is K. In other word, T occurs exactly K times in x. (overlapping allowed)

Now she wants to know the m-th longest relevant string. If there are many, print any.

Example

S="wulwulsswul"
K=2
T="wul"
m=2

Answer=ulwulsswul or wulwulsswu

Explain: All relevant strings are:
- wulwulsswu
- wulwulssw
- wulwulss
- wulwuls
- wulwul
- wulsswul
- lwulsswul
- ulwulsswul

Subtasks

As this problem might be so easy:

For 100% task 1 \leq n,|T| \leq 10^5, 1 \leq m \leq 10^9, 0 \leq k \leq n

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

THE END
分享
二维码
< <上一篇
下一篇>>
文章目录
关闭
目 录