eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Kth Sentence

Kth Sentence

\textit{m} A student, Kita_masa, is taking an English examination. In this examination, he has to write a sentence of length . \textit{m} \textit{K} \textit{K} Since he completely forgot the English grammar, he decided to consider all sentences of length constructed by concatenating the words he knows and write the -th sentence among the candidates sorted in lexicographic order. He believes that it must be the correct sentence because is today's lucky number for him. Each word may be used multiple times (or it's also fine not to use it at all) and the sentence does not contain any extra character between words. Two sentences are considered different if the order of the words are different even if the concatenation resulted in the same string. \InputFile \textit{n} 1 ≤ \textit{n }≤ 100 \textit{m} 1 ≤ \textit{m }≤ 2000 \textit{K} 1 ≤ \textit{K }≤ 10^18 \textit{n} The first line contains three integers (), () and (), separated by a single space. Each of the following lines contains a word that Kita_masa knows. The length of each word is between 1 and 200, inclusive, and the words contain only lowercase letters. You may assume all the words given are distinct. \OutputFile \textit{K} \textit{m} Print the -th (1-based) sentence of length in lexicographic order. If there is no such a sentence, print "\textbf{-}".
Лимит времени 3 секунды
Лимит использования памяти 64 MiB
Входные данные #1
2 10 2
hello
world
Выходные данные #1
helloworld
Источник Japan Alumni Group Winter Contest 2012