#4512. [INOI Team Selection 2021] String
[INOI Team Selection 2021] String
[INOI Team Selection 2021] String
题目描述
Mikaeel has got $n$ strings named $s_{1}, \ldots, s_{n}$ each consists of lower-case English letters. He wants to pick a non-empty substring of each one and concatenate them together to make a final string of size $k$. Help Mikaeel create the smallest lexicographical string possible.输入格式
In the first line, you are given two integers $n$ and $k$, the number of strings and the size of the final string, respectively.The following lines contain the sequence , the strings of Mikaeel.
输出格式
In a single line, print the smallest lexicographical string achievable.3 5
abc
xxx
aaa
abcxa
5 6
ab
bz
zb
aa
cb
abbaab
提示
### ConstraintsSubtasks
| subtask | score | limits |
|---|---|---|
| 1 | 23 | $\forall_{1 \leq i \leq n}, \vert s_{i}\vert = \vert s_{1}\vert \leq 10$, |
| 2 | 19 | $\forall_{1 \leq i \leq n}, \vert s_{i}\vert = \vert s_{1} \vert \leq 20$, |
| 3 | 58 | No extra limits |
| 标签: P12454 | 2021 | INOI(伊朗) |