Problem C

Statement
Copy Copied
Description:
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.

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?

Input Format:
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 Format:
Output single string – name of meeting room printed on $$$k$$$-th label of the delivery.

Note:
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".

Submissions

IDLanguageExit CodeTimestampCodeStdoutStderrRetry
5831 go 0 2026-03-22T04:11:17.701365Z View View View Retry

Evaluations

Eval IDRun IDProviderModelLangSuccessTimestampPromptResponseStdoutStderrRetry
4010 20260325-230005 gemini gemini-3.1-pro-preview go false 2026-03-26T01:46:55.735166Z View View View View Retry
3429 20260321-230009 gemini gemini-3-pro-preview go false 2026-03-22T02:39:05.416978Z View View View View Retry
2477 20260314-020010 gemini gemini-3-pro-preview go false 2026-03-14T03:11:41.529016Z View View View View Retry