CF260E.Dividing Kingdom
省选/NOI-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A country called Flatland is an infinite two-dimensional plane. Flatland has n 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 Ox axis, and two others are parallel to the Oy 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 i-th son should get the part of Flatland that has exactly a__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 i got the part of Flatland which contains a__i cities.
一个名为“平面国”(Flatland)的国家是一片无限延伸的二维平面。平面国内有 n 座城市,每座城市都是平面上的一个点。
平面国由国王“圆四世”(Circle IV)统治。圆四世有 9 个儿子。他打算将平面国划分为 9 个区域,分给每位儿子各自统治。为此,他计划画出四条互不重合的直线:其中两条与 Ox 轴平行,另两条与 Oy 轴平行;且任意一条直线都不能经过任何一座城市。这样,平面国将被划分为 9 个矩形区域(含无界区域),每位儿子恰好分得其中一个区域。圆四世稍作思量,评估了各位儿子的顺从程度后,决定第 i 位儿子应获得恰好包含 ai 座城市的那个区域。
请帮助圆四世找出这样四条直线:当用它们将平面国划分为 9 个区域时,这些区域可被分配给各位儿子,使得第 i 位儿子所获得的区域中恰好包含 ai 座城市。
输入格式
The first line contains integer n (9 ≤ n ≤ 105) — the number of cities in Flatland. Next n lines each contain two space-separated integers: x__i, y__i ( - 109 ≤ x__i, y__i ≤ 109) — the coordinates of the i-th city. No two cities are located at the same point. The last line contains nine space-separated integers:
.
第一行包含一个整数 $ n ( 9 \leq n \leq 10^5 $)—— Flatland 中城市的数量。接下来的 $ n $ 行,每行包含两个以空格分隔的整数:$ x_i,\ y_i ( -10^9 \leq x_i,\ y_i \leq 10^9 $)—— 第 $ i $ 个城市的坐标。任意两座城市均不位于同一点。最后一行包含九个以空格分隔的整数:
输出格式
If there is no solution, print a single integer -1.
Otherwise, print in the first line two distinct real space-separated numbers: _x_1, _x_2 — the abscissas of the straight lines that are parallel to the Oy axis. And in the second line print two distinct real space-separated numbers: _y_1, _y_2 — the ordinates of the straight lines, parallel to the Ox. 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 10 - 6. Two straight lines are considered the same if the distance between them doesn't exceed 10 - 6.
如果无解,输出一个整数 -1。
否则,在第一行输出两个互不相同的实数(以空格分隔):x1, x2 —— 两条平行于 Oy 轴的直线的横坐标;在第二行输出两个互不相同的实数(以空格分隔):y1, y2 —— 两条平行于 Ox 轴的直线的纵坐标。若存在多组解,输出任意一组即可。
在检验答案时,若某城市到某条直线的距离不超过 10−6,则认为该城市位于该直线上;若两条直线之间的距离不超过 10−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.
第一个样例测试的解如下所示:

第二个样例测试的解如下所示:

第三个样例测试无解。
输入解题思路,AI测评打分。不知道怎么写?