QOJ.ac

QOJ

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

#10621. 病毒

الإحصائيات

Bajtosia 在 Bajtocja 最先进的生物实验室工作。她的团队正在研究一种新型病毒。团队成员确定,该病毒的基因型仅由两种类型的基因组成,我们将其标记为 0 和 1。基因型由恰好 $n$ 个这样的基因组成。因此,整个基因型可以用序列 $(X_1, X_2, \dots, X_n)$ 来描述,其中每个元素都是 0 或 1。

不幸的是,这种病毒以一种非常特殊但有规律的方式发生变异。每天,最左侧的基因 $(X_1)$ 会脱离,变为 $X_1 \oplus X_2$($\oplus$ 表示异或运算,即逻辑异或*),然后连接到基因型的最右侧。因此,基因型 $(X_1, X_2, \dots, X_n)$ 在第一次变异后将变为 $(X_2, X_3, \dots, X_n, X_1 \oplus X_2)$。

Bajtosia 现在需要知道 $d$ 天后病毒的基因型是什么。你能帮她吗?

输入格式

输入的第一行包含两个整数 $n$ 和 $d$ ($2 \le n \le 700, 1 \le d \le 10^{15}$),分别表示基因型的长度和病毒发生变异的天数。

第二行也是最后一行包含病毒初始基因型的描述,格式为一个由 $n$ 个字符 $X_1, X_2, \dots, X_n$ ($X_i \in \{0, 1\}$) 组成的字符串;第 $i$ 个字符表示第 $i$ 个基因的类型。

输出格式

输出一行,包含 $d$ 天后病毒的基因型,格式为与输入相同的 $n$ 个字符的字符串。

样例

样例输入 1

5 4
01010

样例输出 1

01111

说明

病毒基因型在接下来的几天里变化如下: $01010 \to 10101 \to 01011 \to 10111 \to 01111$。

子任务

子任务 数据范围 分值
1 $d \le 100$ 7
2 $d \le 2\,000\,000$ 12
3 $n \le 100$ 65
4 无额外限制 16

*该逻辑运算的结果是:当两个参数不同时为 1,相同时为 0。因此 $0 \oplus 1 = 1 \oplus 0 = 1$,而 $0 \oplus 0 = 1 \oplus 1 = 0$。

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.