Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
hackercup / 2013 /round3 /name_the_baby.html
wjomlex's picture
2013 Problems
c623d8c verified
raw
history blame
1.42 kB
<p> Jack is blessed with a baby and he and his wife want to name their child. Jack is a mathematician and his wife is very superstitious. She wants the baby's name to contain at least one of her ancestors names as a substring. They have decided that the baby's name should be exactly <strong>L</strong> characters long, and will only consist of lowercase characters. Jack's wife gives Jack a list of <strong>N</strong> strings, the names of her ancestors. Jack finds all the name possible names for his baby and lists them in alphabetical order. He asks you to choose the <strong>K</strong>th (1-based) name in the list as the name for his child.
</p>
<p>
<h2 id="input">Input</h2>
The first line contains <strong>T</strong>, the number of test cases.
Each test case begins with the value of <strong>L</strong> followed by a single integer <strong>K</strong>.
The next line contains a single integer <strong>N</strong> followed by <strong>N</strong> lines, each containing the name of one of the wife's ancestors.
</p>
<p>
<h2 id="output">Output</h2>
For every test case output the name for the child. If no such name exists print "unnamed baby :(".
</p>
<p>
<h2>Constraints</h2>
1 &le; <strong>T</strong> &le; 20 <br/>
1 &le; <strong>L</strong> &le; 100 <br/>
1 &le; <strong>N</strong> &le; 100 <br>
1 &le; length of each string in the list &le; 100 <br/>
1 &le; <strong>K</strong> &le; 10<sup>18</sup><br/>
</p>