QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 2048 MB 總分: 100 可 Hack ✓

#7673. 传感器网络

统计

无线传感器网络由散布在环境中的自主传感器组成,它们监测温度、声音和压力等条件。

Samantha 是一名研究员,正在从事亚马逊二氧化碳测量(ACM)项目。在该项目中,亚马逊雨林中的无线传感器网络负责收集环境信息。亚马逊雨林储存的碳量相当于全球十年化石燃料的排放量,它在世界的氧气传输过程中起着至关重要的作用。由于森林面积巨大,森林的变化不仅影响当地环境,还会通过改变风和洋流模式影响全球气候。ACM 项目的目标是帮助科学家更好地了解地球复杂的生态系统以及人类活动的影响。

Samantha 有一个重要的假设,为了验证她的假设,她需要找到一个传感器子集,使得该子集中的每一对传感器都能直接通信。如果两个传感器之间的距离不超过 $d$,它们就可以直接通信。为了使实验尽可能准确,Samantha 希望尽可能多地选择传感器。

由于人们不能轻易走进亚马逊,Samantha 无法添加新的传感器,也无法移动现有的传感器。因此,在给定传感器当前位置的情况下,她需要你的帮助来找到满足她条件的最大子集。为简化起见,将每个传感器的位置表示为二维平面上的一个点,两点之间的距离为通常的欧几里得距离。

输入格式

输入包含单个测试用例。第一行包含两个整数 $n$ 和 $d$($1 \le n \le 100$ 且 $1 \le d \le 10\,000$),其中 $n$ 是可用传感器的数量,$d$ 是传感器之间可以直接通信的最大距离。传感器编号为 $1$ 到 $n$。接下来的 $n$ 行,每行包含两个整数 $x$ 和 $y$($-10\,000 \le x, y \le 10\,000$),表示传感器的坐标,按传感器编号顺序给出。

输出格式

输出一个传感器最大子集,使得该子集中的每一对传感器都能直接通信。输出的第一行应为子集的大小。第二行应为子集中传感器的(从 $1$ 开始的)索引。如果存在多个这样的子集,输出其中任意一个即可。

样例

输入格式 1

4 1
0 0
0 1
1 0
1 1

输出格式 1

2
1 2

输入格式 2

5 20
0 0
0 2
100 100
100 110
100 120

输出格式 2

3
4 3 5

Figure 1. Wireless sensor network diagram

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.