CF1028C.Rectangles

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

You are given nn rectangles on a plane with coordinates of their bottom left and upper right points. Some (n−1)(n-1) of the given nn rectangles have some common point. A point belongs to a rectangle if this point is strictly inside the rectangle or belongs to its boundary.

Find any point with integer coordinates that belongs to at least (n−1)(n-1) given rectangles.

平面上给出 nn 个矩形,每个矩形由其左下角和右上角顶点的坐标确定。给定的 nn 个矩形中,有 (n−1)(n-1) 个矩形具有一个公共点。若某点严格位于矩形内部或位于其边界上,则称该点属于该矩形。

请找出任意一个具有整数坐标的点,使得该点至少属于给定的 (n−1)(n-1) 个矩形。

输入格式

The first line contains a single integer nn (2≤n≤132 6742 \le n \le 132\,674) — the number of given rectangles.

Each the next nn lines contains four integers x1x_1, y1y_1, x2x_2 and y2y_2 (−109≤x1<x2≤109-10^9 \le x_1 \lt x_2 \le 10^9, −109≤y1<y2≤109-10^9 \le y_1 \lt y_2 \le 10^9) — the coordinates of the bottom left and upper right corners of a rectangle.

第一行包含一个整数 nn(2≤n≤132 6742 \le n \le 132\,674)—— 给定矩形的数量。

接下来的 nn 行,每行包含四个整数 x1x_1、y1y_1、x2x_2 和 y2y_2(−109≤x1<x2≤109-10^9 \le x_1 \lt x_2 \le 10^9,−109≤y1<y2≤109-10^9 \le y_1 \lt y_2 \le 10^9)—— 分别表示一个矩形的左下角和右上角的坐标。

输出格式

Print two integers xx and yy — the coordinates of any point that belongs to at least (n−1)(n-1) given rectangles.

输出两个整数 xx 和 yy —— 任意一个属于至少 (n−1)(n-1) 个给定矩形的点的坐标。

输入输出样例

  • 输入#1

    3
    0 0 1 1
    1 1 2 2
    3 0 4 1

    输出#1

    1 1
  • 输入#2

    3
    0 0 1 1
    0 1 1 2
    1 0 2 1

    输出#2

    1 1
  • 输入#3

    4
    0 0 5 5
    0 0 4 4
    1 1 4 4
    1 1 4 4

    输出#3

    1 1
  • 输入#4

    5
    0 0 10 8
    1 2 6 7
    2 3 5 6
    3 4 4 5
    8 1 9 2

    输出#4

    3 4

说明/提示

The picture below shows the rectangles in the first and second samples. The possible answers are highlighted.

The picture below shows the rectangles in the third and fourth samples.

下图展示了第一和第二个样例中的矩形。可能的答案已高亮显示。

下图展示了第三和第四个样例中的矩形。

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

首页