SP7258 SUBLEX - Lexicographical Substring Search

    • 39通过
    • 93提交
  • 题目来源 SPOJ 7258
  • 评测方式 RemoteJudge
  • 标签
  • 难度 省选/NOI-
  • 时空限制 299ms / 1536MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 最新讨论 显示

    推荐的相关题目 显示

    题意翻译

    给定一个字符串,求排名第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
    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。