QOJ.ac

QOJ

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

#16899. 互联汽车实验

统计

随着信息通信技术(ICT)的发展,曾经被视为未来汽车的“互联汽车”(connected car)——即通过互联网为驾驶员提供各种服务的汽车——已经成为现实。现代汽车(Hyundai AutoEver)顺应这一趋势,构建了应用云技术、物联网等最新 ICT 的下一代互联汽车服务平台,并正在积累旨在打造顶级互联汽车的核心软件技术。

现代汽车的工程师贤奥在构思新服务时,决定进行一项结合互联汽车核心技术——物联网与位置技术的实验。贤奥开发的实验程序具有以下功能:

  • 贤奥可以远程操控已连接到物联网的互联汽车。
  • 当已连接到物联网的互联汽车与未连接的互联汽车处于同一位置时,可以将该互联汽车连接到物联网。此后,即使两辆互联汽车再次远离,连接仍会保持。

为了进行实验,贤奥将编号为 1 到 $N$ 的 $N$ 辆互联汽车排成一列。第 $i$ 辆互联汽车的初始位置为 $x_i$,燃料量为 $h_i$。所有互联汽车消耗 1 单位燃料可以移动 1 的距离,燃料耗尽后将无法继续移动。

起初,所有互联汽车均未连接到物联网。贤奥首先将第 $S$ 辆互联汽车连接到物联网,并计划通过适当地使用程序功能,将物联网连接传播给其他互联汽车。

根据贤奥操作互联汽车的方式不同,实验中可能连接到物联网的互联汽车组合也会有所不同。请找出在贤奥通过各种方法进行多次实验时,所有可能连接到物联网的互联汽车。

输入格式

第一行给出 $N$ 和 $S$。($1 \le N \le 1\,000\,000$; $1 \le S \le N$)

第二行依次给出各互联汽车的初始位置 $x_1, x_2, \dots, x_N$,以空格分隔。($0 \le x_i \le 10^9$; $x_i \le x_{i+1}$)

第三行依次给出各互联汽车的燃料量 $h_1, h_2, \dots, h_N$,以空格分隔。($1 \le h_i \le 10^9$)

输出格式

第一行按升序输出所有可能连接到物联网的互联汽车编号。

样例

输入 1

5 3
1 2 4 5 8
2 1 2 2 3

输出 1

1 2 3 4

说明 1

样例中实验结果可能出现的连接到物联网的互联汽车组合有 $\{1, 2, 3\}, \{2, 3\}, \{3\}, \{3, 4\}$。

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.