CF260E.Dividing Kingdom

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

A country called Flatland is an infinite two-dimensional plane. Flatland has nn cities, each of them is a point on the plane.

Flatland is ruled by king Circle IV. Circle IV has 9 sons. He wants to give each of his sons part of Flatland to rule. For that, he wants to draw four distinct straight lines, such that two of them are parallel to the OxOx axis, and two others are parallel to the OyOy axis. At that, no straight line can go through any city. Thus, Flatland will be divided into 9 parts, and each son will be given exactly one of these parts. Circle IV thought a little, evaluated his sons' obedience and decided that the ii -th son should get the part of Flatland that has exactly aia_{i} cities.

Help Circle find such four straight lines that if we divide Flatland into 9 parts by these lines, the resulting parts can be given to the sons so that son number ii got the part of Flatland which contains aia_{i} cities.

输入格式

The first line contains integer n (9<=n<=105)n\ (9<=n<=10^{5}) — the number of cities in Flatland. Next nn lines each contain two space-separated integers: xi,yi (109<=xi,yi<=109)x_{i},y_{i}\ (-10^{9}<=x_{i},y_{i}<=10^{9}) — the coordinates of the ii -th city. No two cities are located at the same point. The last line contains nine space-separated integers: .

输出格式

If there is no solution, print a single integer -1.

Otherwise, print in the first line two distinct real space-separated numbers: x1,x2x_{1},x_{2} — the abscissas of the straight lines that are parallel to the OyOy axis. And in the second line print two distinct real space-separated numbers: y1,y2y_{1},y_{2} — the ordinates of the straight lines, parallel to the OxOx . If there are multiple solutions, print any of them.

When the answer is being checked, a city is considered to lie on a straight line, if the distance between the city and the line doesn't exceed 10610^{-6} . Two straight lines are considered the same if the distance between them doesn't exceed 10610^{-6} .

输入输出样例

  • 输入#1

    9
    1 1
    1 2
    1 3
    2 1
    2 2
    2 3
    3 1
    3 2
    3 3
    1 1 1 1 1 1 1 1 1
    

    输出#1

    1.5000000000 2.5000000000
    1.5000000000 2.5000000000
    
  • 输入#2

    15
    4 4
    -1 -3
    1 5
    3 -4
    -4 4
    -1 1
    3 -3
    -4 -5
    -3 3
    3 2
    4 1
    -4 2
    -2 -5
    -3 4
    -1 4
    2 1 2 1 2 1 3 2 1
    

    输出#2

    -3.5000000000 2.0000000000
    3.5000000000 -1.0000000000
    
  • 输入#3

    10
    -2 10
    6 0
    -16 -6
    -4 13
    -4 -2
    -17 -10
    9 15
    18 16
    -5 2
    10 -5
    2 1 1 1 1 1 1 1 1
    

    输出#3

    -1
    

说明/提示

The solution for the first sample test is shown below:

The solution for the second sample test is shown below:

There is no solution for the third sample test.

首页