QOJ.ac

QOJ

Puntuación total: 100

#9471. 秘密诗篇

Estadísticas

雍正皇帝(1678年12月13日 – 1735年10月8日)是中国清朝的第五位皇帝。他是一位非常勤政的统治者。他严厉打击腐败,其统治以专制、高效和强力著称。

雍正无法容忍人们说关于清朝或他本人的坏话。因此,他发起了一场名为“文字狱”的运动。“文字狱”意为文学上的审讯。在著名的庄廷鑨案中,由于出版了一部未经授权的明朝历史,三年内有超过 70 人被处决。

简而言之,在雍正统治下,人们如果想写点什么,必须非常小心。因此,一些诗人以一种非常奇特的方式写诗,只有他们朋友圈子里的人才能读懂。这种诗被称为“藏头诗”(secret poems)。

藏头诗是一个 $N \times N$ 的字符矩阵,看起来杂乱无章,毫无意义。但如果你按照特定的顺序阅读这些字符,你就能理解其中的含义。阅读顺序如图 1 所示:

图 1 和 图 2

按照箭头指示的顺序,你可以得到 “THISISAVERYGOODPOEMITHINK”,这可能具有某种含义。

但过了一段时间,诗人们发现雍正的一些秘密特工,被称为“血滴子”,也能读懂这种诗。这太危险了。因此,他们引入了一种新的写诗顺序,如图 2 所示。他们希望将按照图 1 旧顺序编写的诗转换为新顺序的诗。请帮助他们。

输入格式

测试用例不超过 10 组。

对于每个测试用例: 第一行是一个整数 $N$ ($1 \le N \le 100$),表示诗是一个由大写字母组成的 $N \times N$ 矩阵。 接下来有 $N$ 行,每行是一个长度为 $N$ 的字符串。这 $N$ 行代表了旧顺序下的诗。

输出格式

对于每个测试用例,将旧顺序的诗转换为新顺序的诗。

样例

输入格式 1

5
THSAD
IIVOP
SEOOH
RGETI
YMINK
2
AB
CD
4
ABCD
EFGH
IJKL
MNOP

输出格式 1

THISI
POEMS
DNKIA
OIHTV
OGYRE
AB
DC
ABEI
KHLF
NPOC
MJGD

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.