CF1028C.Rectangles

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

You are given nn rectangles on a plane with coordinates of their bottom left and upper right points. Some (n1)(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 (n1)(n-1) given rectangles.

输入格式

The first line contains a single integer nn ( 2n1326742 \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 ( 109x1<x2109-10^9 \le x_1 < x_2 \le 10^9 , 109y1<y2109-10^9 \le y_1 < y_2 \le 10^9 ) — the coordinates of the bottom left and upper right corners of a rectangle.

输出格式

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

输入输出样例

  • 输入#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测评打分。不知道怎么写?

首页