题目描述
Problem Background
To study the problem of outputting the Manhattan distance between two points on a dynamic cactus graph based on fully persistent suffix global balanced tree maintenance using operation order divide-and-conquer branch-and-bound heuristic blossom tree minimum cost flow with upper and lower bounds, will needs to generate some letter sequences.
While writing the generator, due to will's lack of skill, he encountered some issues. Now, he needs clever you to help him solve these problems.
Problem Description
The workflow of the sequence generator is as follows:
- will first specifies a parent sequence, which is of length N and consists of lowercase letters.
- A subsequence is defined as: a non-empty sequence obtained by deleting zero or more characters from the parent sequence at any position. For example: "ab" and "ac" are subsequences of "abc", but "ca" is not.
- Obviously, a sequence of length N has $2^N-1$ subsequences.
- These $2^N-1$ subsequences are sorted lexicographically. will will generate subsequences in lexicographical order.
- will wants to remove duplicate subsequences. If several subsequences are duplicates (equal in lexicographical order), only one is generated.
- Now, he wants to know what the K-th generated subsequence by the generator is?
Input Output Format
Input Format
- The first line contains two positive integers N and K. N represents the length of the parent sequence, and K represents the query.
- The next line contains N lowercase letters, representing the parent sequence.
Output Format
- One line of lowercase letters representing the sequence, which is the K-th generated sequence by the generator.
Sample Input and Output
Sample Input #1
3 3
abb
Sample Output #1
abb
Sample Input #2
3 5
abb
Sample Output #2
bb
Notes
Explanation of the Sample
For the parent sequence "abb", there are 7 subsequences, sorted lexicographically:
- a
- ab
- ab
- abb
- b
- b
- bb
After removing duplicates, the 3rd one is "abb".
Data Range
- For 20% of the data, $N \leq 15$;
- For 50% of the data, $N \leq 1000$;
- For 80% of the data, $N \leq 200000$;
- For 100% of the data, $N \leq 1000000, K \leq 10^9$, and it is guaranteed that there is a K-th output;
- The time limit for the first 80% of the data is 1s, and for the last 20% of the data, it is 2s.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分