spoj7258 SUBLEX Lexicographical Substring Search
http://www.elijahqi.win/archives/3001
題意翻譯
給定一個字符串,求排名第k小的串
注意樣例的\n是換行
輸入格式:
第一行給定主串(len<=90000)
第二行給定詢問個數T<=500
隨后給出T行T個詢問,每次詢問排名第k小的串,范圍在int內
輸出格式:
對于每一個詢問,輸出T行,每行為排名第k小的串
感謝@Creeper_LKF 提供的翻譯
題目描述
Little Daniel loves to play with strings! He always finds different ways to have fun with strings! Knowing that, his friend Kinan decided to test his skills so he gave him a string S and asked him Q questions of the form:
If all distinct substrings of string S were sorted lexicographically, which one will be the K-th smallest?
After knowing the huge number of questions Kinan will ask, Daniel figured out that he can’t do this alone. Daniel, of course, knows your exceptional programming skills, so he asked you to write him a program which given S will answer Kinan’s questions.
Example:
S = “aaa” (without quotes)
substrings of S are “a” , “a” , “a” , “aa” , “aa” , “aaa”. The sorted list of substrings will be:
“a”, “aa”, “aaa”.
Input
In the first line there is Kinan’s string S (with length no more than 90000 characters). It contains only small letters of English alphabet. The second line contains a single integer Q (Q <= 500) , the number of questions Daniel will be asked. In the next Q lines a single integer K is given (0 < K < 2^31).
Output
Output consists of Q lines, the i-th contains a string which is the answer to the i-th asked question.
輸入輸出格式
輸入格式:
輸出格式:
輸入輸出樣例
輸入樣例#1: 復制
\naaa\n2\n2\n3\n\n
輸出樣例#1: 復制
aa\naaa\n
類似tjoi2015弦論 處理之后類似二分 針對每次詢問 暴力去sam中處理即可
總結
以上是生活随笔為你收集整理的spoj7258 SUBLEX Lexicographical Substring Search的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: user后面的计算机名更改,更改电脑用户
- 下一篇: sqlserver清除换行符和回车符\r