CF1271C.Shawarma Tent

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes.

The main school of the capital is located in (sx,sy)(s_x, s_y) . There are nn students attending this school, the ii -th of them lives in the house located in (xi,yi)(x_i, y_i) . It is possible that some students live in the same house, but no student lives in (sx,sy)(s_x, s_y) .

After classes end, each student walks from the school to his house along one of the shortest paths. So the distance the ii -th student goes from the school to his house is sxxi+syyi|s_x - x_i| + |s_y - y_i| .

The Provision Department of Berland has decided to open a shawarma tent somewhere in the capital (at some point with integer coordinates). It is considered that the ii -th student will buy a shawarma if at least one of the shortest paths from the school to the ii -th student's house goes through the point where the shawarma tent is located. It is forbidden to place the shawarma tent at the point where the school is located, but the coordinates of the shawarma tent may coincide with the coordinates of the house of some student (or even multiple students).

You want to find the maximum possible number of students buying shawarma and the optimal location for the tent itself.

输入格式

The first line contains three integers nn , sxs_x , sys_y ( 1n2000001 \le n \le 200\,000 , 0sx,sy1090 \le s_x, s_y \le 10^{9} ) — the number of students and the coordinates of the school, respectively.

Then nn lines follow. The ii -th of them contains two integers xix_i , yiy_i ( 0xi,yi1090 \le x_i, y_i \le 10^{9} ) — the location of the house where the ii -th student lives. Some locations of houses may coincide, but no student lives in the same location where the school is situated.

输出格式

The output should consist of two lines. The first of them should contain one integer cc — the maximum number of students that will buy shawarmas at the tent.

The second line should contain two integers pxp_x and pyp_y — the coordinates where the tent should be located. If there are multiple answers, print any of them. Note that each of pxp_x and pyp_y should be not less than 00 and not greater than 10910^{9} .

输入输出样例

  • 输入#1

    4 3 2
    1 3
    4 2
    5 1
    4 1
    

    输出#1

    3
    4 2
    
  • 输入#2

    3 100 100
    0 0
    0 0
    100 200
    

    输出#2

    2
    99 100
    
  • 输入#3

    7 10 12
    5 6
    20 23
    15 4
    16 5
    4 54
    12 1
    4 15
    

    输出#3

    4
    10 11
    

说明/提示

In the first example, If we build the shawarma tent in (4,2)(4, 2) , then the students living in (4,2)(4, 2) , (4,1)(4, 1) and (5,1)(5, 1) will visit it.

In the second example, it is possible to build the shawarma tent in (1,1)(1, 1) , then both students living in (0,0)(0, 0) will visit it.

首页