QOJ.ac

QOJ

حد الوقت: 3 s حد الذاكرة: 2048 MB مجموع النقاط: 100

#2202. 字典序

الإحصائيات

Lucy 喜欢字母。她在学校学习了字典序的定义,并经常以此为乐。

起初,她尝试用给定的字母构造字典序最小的单词。这太简单了! 后来,她尝试构造多个单词并最小化其中一个。这要困难得多!

形式化地说,Lucy 想要用给定的 $n \cdot l$ 个字母构造 $n$ 个长度均为 $l$ 的单词,使得这 $n$ 个单词按字典序排列后,第 $k$ 个单词的字典序尽可能小。

输入格式

第一行包含三个整数 $n, l$ 和 $k$ ($1 \le k \le n \le 1000; 1 \le l \le 1000$),分别表示单词的总数、每个单词的长度,以及 Lucy 想要最小化的单词的索引。

第二行包含一个由 $n \cdot l$ 个小写英文字母组成的字符串。

输出格式

输出 $n$ 个长度为 $l$ 的单词,每行一个,使用输入中给定的字母。这些单词必须按字典序排列,且其中第 $k$ 个单词的字典序应尽可能小。如果存在多种使得第 $k$ 个单词字典序最小的方案,输出其中任意一种即可。

样例

样例输入 1

3 2 2
abcdef

样例输出 1

af
bc
ed

样例输入 2

2 3 1
abcabc

样例输出 2

aab
bcc

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.