CF97B.Superset

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

A set of points on a plane is called good, if for any two points at least one of the three conditions is true:

  • those two points lie on same horizontal line;
  • those two points lie on same vertical line;
  • the rectangle, with corners in these two points, contains inside or on its borders at least one point of the set, other than these two. We mean here a rectangle with sides parallel to coordinates' axes, the so-called bounding box of the two points.

You are given a set consisting of n points on a plane. Find any good superset of the given set whose size would not exceed 2·105 points.

平面上的一组点被称为“好”的,当且仅当对其中任意两点,以下三个条件中至少有一个成立:

  • 这两点位于同一水平线上;
  • 这两点位于同一竖直线上;
  • 以这两点为对角顶点(即其轴对齐边界框)所构成的矩形,在其内部或边界上至少包含该集合中除这两点外的另一个点。

现给定平面上由 $ n $ 个点组成的集合。请找出该集合的一个“好”的超集,其大小不超过 $ 2 \cdot 10^5 $ 个点。

输入格式

The first line contains an integer n (1 ≤ n ≤ 104) — the number of points in the initial set. Next n lines describe the set's points. Each line contains two integers x__i and y__i ( - 109 ≤ x__i, y__i ≤ 109) — a corresponding point's coordinates. It is guaranteed that all the points are different.

第一行包含一个整数 nn(1≤n≤1041 \leq n \leq 10^4)—— 初始点集中的点的数量。接下来的 nn 行描述该点集中的点。每行包含两个整数 xix_i 和 yiy_i(−109≤xi,yi≤109-10^9 \leq x_i, y_i \leq 10^9)—— 对应点的坐标。保证所有点互不相同。

输出格式

Print on the first line the number of points m (n ≤ m ≤ 2·105) in a good superset, print on next m lines the points. The absolute value of the points' coordinates should not exceed 109. Note that you should not minimize m, it is enough to find any good superset of the given set, whose size does not exceed 2·105.

All points in the superset should have integer coordinates.

第一行输出一个整数 $ m $(满足 $ n \leq m \leq 2\cdot10^5 $),表示所构造的“好超集”中点的个数;接下来的 $ m $ 行,每行输出一个点的坐标。所有点的坐标的绝对值不得超过 $ 10^9 $。注意:你无需最小化 $ m $,只需构造出任意一个包含给定集合的“好超集”,且其大小不超过 $ 2\cdot10^5 $ 即可。

超集中所有点的坐标均为整数。

输入输出样例

  • 输入#1

    2
    1 1
    2 2

    输出#1

    3
    1 1
    2 2
    1 2

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

首页