QOJ.ac

QOJ

时间限制: 2 s 内存限制: 2048 MB 总分: 100

#15639. 寻找 KIT

统计

《Find the Fox》(寻找狐狸)是一本最近出版的书,书中包含 200 页仅由字母 'F'、'O' 和 'X' 组成的单词搜索谜题。这本书的特别之处在于,在整本书的所有页面中,单词 “FOX” 只出现过一次。

回想一下,在单词搜索游戏中,目标是在字母网格中找到隐藏的单词(在本游戏中只有一个隐藏单词)。单词可以水平、垂直或对角线方向出现,也可以正向或反向拼写,总共允许 8 个不同的阅读方向。

对于今年的 NWERC,我们希望制作一个简化版的《Find the Fox》。因此,你在本题中的目标是创建一个给定尺寸的单词搜索网格,且其中字母 'K'、'I' 和 'T' 的出现次数分别等于给定的数量。与原书类似,该网格中必须恰好包含一次单词 “KIT”。

图 K.1:样例输出 1 的示意图。翻页查看解答。

输入格式

输入包含:

  • 一行,包含五个整数 $h, w, k, i$ 和 $t$($3 \le h, w \le 100$,$k, i, t \ge 1$,$k + i + t = h \cdot w$),其中 $h$ 和 $w$ 分别表示单词搜索网格的高度和宽度,$k, i$ 和 $t$ 分别指定所需的字母 'K'、'I' 和 'T' 的出现次数。

输出格式

输出一个符合上述规则的单词搜索网格。可以证明,这样的单词搜索网格总是存在的。

如果存在多个有效解,你可以输出其中任意一个。

样例

样例输入 1

4 5 6 7 7

样例输出 1

IKIIT
KKTKT
ITITI
KTTKI

样例输入 2

3 3 1 7 1

样例输出 2

III
KIT
III

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.