CF2225E.Covering Points with Circles

入门

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given an array pp containing nn points with integer coordinates. These points are uniformly distributed inside some rectangle whose sides are parallel to the coordinate axes.

You need to place several circles so that the following conditions hold:

  • the radius of each circle is equal to rr, and its center has integer coordinates;
  • for every pair of circles, the area of their intersection is 00 (but the circles may touch);
  • at least 8989% of all points lie inside some circle or on the boundary of some circle (in other words, the number of points lying inside the circles or on their boundaries is at least 89n100\frac{89n}{100}).

The rectangle in which the points from array pp are distributed is unknown to you, but in all tests except for the example it is guaranteed that the area of one circle of radius rr does not exceed 110\frac{1}{10} of the area of this rectangle.

给你一个包含 nn 个整数坐标点的数组 pp。这些点均匀分布在某个边与坐标轴平行的矩形内部。

你需要放置若干个圆,使得满足以下条件:

  • 每个圆的半径均为 rr,且其圆心坐标为整数;
  • 任意两个圆的交集面积为 00(但两圆可以相切);
  • 至少 89%89\% 的所有点位于某个圆的内部或边界上(即:位于圆内或圆边界上的点的数量至少为 89n100\frac{89n}{100})。

数组 pp 中的点所分布的矩形对你而言是未知的;但在除样例外的所有测试中,保证半径为 rr 的单个圆的面积不超过该矩形面积的 110\frac{1}{10}

输入格式

The first line contains two integers nn and rr (4n1044 \le n \le 10^4, 102r10310^2 \le r \le 10^3).

The next nn lines each contain two integers pxp_{x} and pyp_{y} (105px,py105-10^5 \le p_x, p_y \le 10^5).

There are 4040 tests in this problem. For each test except the example from the statement, the following constraints hold:

  • the number of points is 10410^4;
  • all points are generated as follows: first, some integer xx from 300300 to 10510^5 is chosen; after that, nn distinct integer points are chosen uniformly at random in the rectangle [x,x]×[x,x][-x, x] \times [-x, x];
  • the area of a circle of radius rr does not exceed 110\frac{1}{10} of the area of the rectangle [x,x]×[x,x][-x, x] \times [-x, x];
  • there exists a set of circles satisfying the conditions of the problem.

Hacks are disabled in this problem.

第一行包含两个整数 nnrr4n1044 \le n \le 10^4102r10310^2 \le r \le 10^3)。

接下来的 nn 行每行包含两个整数 pxp_{x}pyp_{y}105px,py105-10^5 \le p_x, p_y \le 10^5)。

本题共有 4040 个测试用例。对于除题目陈述中给出的示例外的所有测试用例,均满足以下约束条件:

  • 点的数量为 10410^4
  • 所有点按如下方式生成:首先随机选取一个介于 30030010510^5 之间的整数 xx;随后在矩形区域 [x,x]×[x,x][-x, x] \times [-x, x] 内均匀随机地选取 nn 个互不相同的整数点;
  • 半径为 rr 的圆的面积不超过矩形 [x,x]×[x,x][-x, x] \times [-x, x] 面积的 110\frac{1}{10}
  • 存在一组满足题目条件的圆。

本题禁止使用 Hack 功能。

输出格式

In the first line, output one integer kk (1kn1 \le k \le n) — the number of circles. In each of the next kk lines, output two integers xx and yy — the coordinates of the center of the ii-th circle. The coordinates of centers of the circles you output should not exceed 21052 \cdot 10^5 by absolute value.

If there are multiple solutions, output any of them. You do not need to minimize the number of circles, but it should not exceed nn.

第一行输出一个整数 kk1kn1 \le k \le n)—— 圆的个数。接下来的 kk 行中,每行输出两个整数 xxyy —— 第 ii 个圆的圆心坐标。你所输出的各圆圆心坐标的绝对值不得超过 21052 \cdot 10^5

若存在多种解法,输出任意一种即可。你无需最小化圆的个数,但其值不得超过 nn

输入输出样例

  • 输入#1

    4 100
    0 0
    0 100
    100 0
    100 100

    输出#1

    1
    70 70

说明/提示

One possible covering for the first sample is shown in the figure:

第一个样例的一种可能覆盖方式如图所示:

输入解题思路,AI测评打分。不知道怎么写?

首页