1106:Transmitters(离散化,已翻译题目)

文章探讨了在多发射机共享频率的无线网络中,如何通过限制发射机的半圆形覆盖区域来避免信号重叠。提出了一种离散化方法,通过枚举直径上的点并确定有效角度,以在O(n)时间内找到最大覆盖点数,同时优化了计算效率。
摘要由CSDN通过智能技术生成
描述

In a wireless network with multiple transmitters sending on the same frequencies, it is often a requirement that signals don't overlap, or at least that they don't conflict. One way of accomplishing this is to restrict a transmitter's coverage area. This problem uses a shielded transmitter that only broadcasts in a semicircle.

A transmitter T is located somewhere on a 1,000 square meter grid. It broadcasts in a semicircular area of radius r. The transmitter may be rotated any amount, but not moved. Given N points anywhere on the grid, compute the maximum number of points that can be simultaneously reached by the transmitter's signal. Figure 1 shows the same data points with two different transmitter rotations.

All input coordinates are integers (0-1000). The radius is a positive real number greater than 0. Points on the boundary of a semicircle are considered within that semicircle. There are 1-150 unique points to examine per transmitter. No points are at the same location as the transmitter.

在多个发射机发送相同频率的无线网络中,通常要求信号不能重叠,或者至少不能相互冲突。实现这一点的一种方法是限制发射机的覆盖面积。这个问题使用的屏蔽发射机只能在半圆内广播。发射机 T 位于1000平方米网格的某个地方。它在半径为 r 的半圆范围内广播。发射机可以旋转任何数量,但不能移动。给定网格上任何地方的 N 个点,计算发射机信号可以同时达到的最大点数。图1显示了具有两个不同发射机旋转的相同数据点。所有输入坐标都是整数(0-1000)。半径是一个大于0的正实数。在半圆的边界上的点被认为是在那个半圆内。每个发射机有1-150个独特的点可以检查。没有一个点和发射器在同一个位置。

输入
Input consists of information for one or more independent transmitter problems. Each problem begins with one line containing the (x,y) coordinates of the transmitter followed by the broadcast radius, r. The next line contains the number of points N on the grid, followed by N sets of (x,y) coordinates, one set per line. The end of the input is signalled by a line with a negative radius; the (x,y) values will be present but indeterminate. Figures 1 and 2 represent the data in the first two example data sets below, though they are on different scales. Figures 1a and 2 show transmitter rotations that result in maximal coverage.

输入由一个或多个独立发射机问题的信息组成。每个问题都从一条线开始,这条线包含发射机的(x,y)坐标和广播半径 r。下一行包含网格上的点数 N,后面跟着 N 组(x,y)坐标,每行一组。输入的末尾用一条半径为负的线表示; (x,y)值将会出现,但是不确定。图1和图2代表了下面前两个示例数据集中的数据,尽管它们在不同的尺度上。图1a 和2显示了导致最大覆盖率的发射机旋转。

输出
For each transmitter, the output contains a single line with the maximum number of points that can be contained in some semicircle.

对于每个发射机,输出包含一个单一的线路与最大数量的点,可以包含在一些半圆。

样例输入
25 25 3.5
7
25 28
23 27
27 27
24 23
26 23
24 29
26 29
350 200 2.0
5
350 202
350 199
350 198
348 200
352 200
995 995 10.0
4
1000 1000
999 998
990 992
1000 999
100 100 -2.5

样例输出
3
4
4

来源
Mid-Central USA 2001


分析

首先,只有圆内或圆上的点才有可能被覆盖,所以先预处理将圆外的点全部舍弃。

然后,直观的想法是枚举每个角度,然后计算符合条件的点的个数。但是这种想法是无法实现的,因为你无法确定每次要旋转多少度。

接着,引入 离散化 的思想:最优解一定可以保证至少有一个点在直径上。

可以通过反证法进行证明:若没有点在直径上,通过顺时针(或逆时针)旋转一个角,使得至少有一个点在直径上,得到的结果一定不会更差。

如此,便可根据此性质,通过枚举每个可能在直径上的点,从而在O(n)内枚举出所有的角度(这里指有用的角度)。

然后,对于每个角度,可以再在O(n)内暴力找出所有在这条直径左手边(或右手边,下面以左手边为例)的点,更新最大值。

那么,还用不用考虑这条直径右手边的点了呢?

假设当前枚举到的点是A,则对于这条直径,只有两种情况:

1、点B存在。

那么,当枚举到点B的时候,可以考虑到直径下面的情况。

2、点B不存在。

那么,当直径逆时针旋转到与D相交时,得到的结果不会更差。

因为从OB到OD旋转的这段角度内下半部分的扇形没有点存在,而与其对应的上半部分有可能已经覆盖到了其他的点,所以覆盖的点只可能增加。

即这种情况下,当枚举到点D的时候,可以得到不会更差的解。所以可以忽略掉这种情况。

所以,每次就不用考虑直径右手边点的情况了。

  • 28
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值