307152: CF1310C. Au Pont Rouge

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Au Pont Rouge

题意翻译

给出一个长度为 $n$ 的字符串 $S$ 以及整数 $m,k$。 对于一个把 $S$ 分割成非空的 $m$ 段的一个方案,我们用这个方案中分割出的字典序最小的一个串代表这个分割方案。 eg. $S=abaabb,m=3$,存在分割方案 $\{ab,aab,b\}$,则我们用字典序最小的 $aab$ 来代表这个分割方案。 现在把**所有分割方案对应的代表该方案的串**按字典序**从大到小**排序,求排序后的第 $k$ 个串。

题目描述

VK just opened its second HQ in St. Petersburg! Side of its office building has a huge string $ s $ written on its side. This part of the office is supposed to be split into $ m $ meeting rooms in such way that meeting room walls are strictly between letters on the building. Obviously, meeting rooms should not be of size 0, but can be as small as one letter wide. Each meeting room will be named after the substring of $ s $ written on its side. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1310C/3f4208069ef8a30005bed865124fbaec7ac1508a.png)For each possible arrangement of $ m $ meeting rooms we ordered a test meeting room label for the meeting room with lexicographically minimal name. When delivered, those labels got sorted backward lexicographically. What is printed on $ k $ th label of the delivery?

输入输出格式

输入格式


In the first line, you are given three integer numbers $ n, m, k $ — length of string $ s $ , number of planned meeting rooms to split $ s $ into and number of the interesting label ( $ 2 \le n \le 1\,000; 1 \le m \le 1\,000; 1 \le k \le 10^{18} $ ). Second input line has string $ s $ , consisting of $ n $ lowercase english letters. For given $ n, m, k $ there are at least $ k $ ways to split $ s $ into $ m $ substrings.

输出格式


Output single string – name of meeting room printed on $ k $ -th label of the delivery.

输入输出样例

输入样例 #1

4 2 1
abac

输出样例 #1

aba

输入样例 #2

19 5 1821
aupontrougevkoffice

输出样例 #2

au

说明

In the first example, delivery consists of the labels "aba", "ab", "a". In the second example, delivery consists of $ 3060 $ labels. The first label is "aupontrougevkof" and the last one is "a".

Input

题意翻译

给出一个长度为 $n$ 的字符串 $S$ 以及整数 $m,k$。 对于一个把 $S$ 分割成非空的 $m$ 段的一个方案,我们用这个方案中分割出的字典序最小的一个串代表这个分割方案。 eg. $S=abaabb,m=3$,存在分割方案 $\{ab,aab,b\}$,则我们用字典序最小的 $aab$ 来代表这个分割方案。 现在把**所有分割方案对应的代表该方案的串**按字典序**从大到小**排序,求排序后的第 $k$ 个串。

加入题单

上一题 下一题 算法标签: