QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 256 MB 总分: 100 可 Hack ✓

#10839. 今日单词

统计

你接受了 VortaroEnMano Inc. 的工作邀请,这是一家致力于创建最全面的世界语词典的公司。Esperanto estas tre mojosa lingvo,所以你非常努力地工作,以尽你所能——主要是为了在就业萧条时期保住你的工作。

今天,你被分配重构一个名为“Hodiaŭa Vorto”(即英语中的“Today’s Word”)的函数。这个词是由一个字符串生成的,记为 $S_k$。

$S_k$ 的生成方式如下:

  1. 该过程从给定的初始字符串 $S_0$ 开始。该字符串仅包含小写英文字母,且长度为偶数。
  2. 对于 $n \geq 1$,$S_n$ 的生成方式如下:$S_n = S_{n-1}[0 \dots \frac{l}{2}-1] + S_{n-1} + \text{next}(S_{n-1}[\frac{l}{2} \dots l-1])$,其中 $l$ 是 $S_{n-1}$ 的长度,而 $+$ 用于连接字符串。注意字符串的索引从 0 开始。

函数 $\text{next}(S)$ 将字符串 $S$ 中的每个字符递增为字母表中的下一个字母,即 $\text{a}$ 变为 $\text{b}$,$\text{b}$ 变为 $\text{c}$,以此类推,$\text{z}$ 变为 $\text{a}$。例如,$\text{next}(\text{abz}) = \text{bca}$。

你的任务是确定 $S_{10^{100}}$ 长度为 $m$ 的后缀。

输入格式

第一行包含两个整数 $n$ 和 $m$ ($1 \leq n, m \leq 10^5$),分别表示 $S_0$ 的长度和所需后缀的长度。保证 $n$ 是一个偶数。

第二行包含一个字符串 $S_0$,由 $n$ 个小写英文字母组成。

输出格式

输出一个长度为 $m$ 的字符串,表示你所需要确定的后缀。

样例

样例输入 1

6 10
bocchi

样例输出 1

wrwxrwxsxy

说明

在提供的示例中,$S_1 = \text{boc} + \text{bocchi} + \text{dij}$。

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.