QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 2048 MB Total points: 100

#1297. 硬盘

Statistics

Pia 正在准备前往埃因霍温参加 NWERC 2018。在打包硬盘时,她想起了航空公司荒谬的重量限制,这可能会带来麻烦。硬盘本质上是一串 0 和 1,其重量取决于其中“位变化”的数量:对于任意两个相邻且存储值不同的位,硬盘会稍微变重一些,因此 Pia 不能在上面随意存储信息。

更糟糕的是,这个硬盘太旧了,以至于一些位已经损坏,并且总是存储 0。第一位永远不会损坏,但最后一位总是损坏的。

Pia 决定将这种情况视为一项挑战:她现在试图修改硬盘上的信息,使其恰好具有航空公司允许的最大位变化数。然而,损坏的位使这比预期的更困难,所以她需要你的帮助。

请找出一个可以存储在硬盘上,且恰好具有所需位变化数的位模式。

输入格式

输入包含: 第一行包含三个整数 $n, c$ 和 $b$ ($2 \le n \le 5 \cdot 10^5, 1 \le c, b \le n - 1$),分别表示硬盘的位数、所需的位变化数以及损坏位的数量。硬盘上的位置编号从 $1$ 到 $n$。 第二行包含 $b$ 个整数 $z_1, \dots, z_b$ ($2 \le z_1 < z_2 < \dots < z_b = n$),表示硬盘上损坏位的位置。

输出格式

输出一个长度为 $n$ 的位字符串,表示 Pia 的硬盘,且包含恰好 $c$ 个位变化。如果存在多个有效解,你可以输出其中任意一个。题目保证至少存在一个解。

样例

样例输入 1

5 2 3
2 3 5

样例输出 1

00010

样例输入 2

7 4 2
2 7

样例输出 2

0010110

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.