CF949F.Astronomy
NOI/NOI+/CTSC
通过率:0%
时间限制:5.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Year 18 AD. Famous astronomer Philon the Berlander publishes a book "About Sky and Cosmos», in which he describes an incredible picture seen by him on a night sky while observing the skies. He once seen 2_n_ stars on a clear sky and the Moon. Surprisingly, it was possible to divide all stars in pairs in such way that any line passing through the centers of two paired stars also passed through the center of the Moon, also all such lines were distinct. Philon carefully represented such a situation on a sky map, introducing a coordinate system. While doing that, he noticed that centers of all stars and the center of the Moon are points with integer coordinates. As Philon thought that the Earth and the Moon were flat, his coordinate system was two-dimensional. Coordinate system was chosen by an astronomer in such way that the coordinates of all objects (including the Moon) are no more than 106 by the absolute value. Moreover, no two objects (two stars or a star and a Moon) were not located at the same point.
Apart from the sky map Philon wrote a prediction that in 2000 years stars will take exactly the same places, but the Moon will be replaced by a huge comet which will destroy the Earth.
It is 2018 AD now. You got a book of Philon the Berlander and you were horrified to discover that the stars on the sky are in exactly the same position as they were 2000 years ago! Unfortunately, some parts of a sky map were lost, so there are only star locations that are visible on it and there are no details about how the stars were divided in pairs. Moreover,, there is no point corresponding to the center of the Moon on this map. In order to find out the possible location of a comet and save the humanity from the terrible end, you should immediately find out some suitable location for the center of the Moon!
公元18年。著名天文学家贝尔兰德的菲隆(Philon the Berlander)出版了一本著作《论天空与宇宙》,其中描述了他在一次夜观天象时所见到的惊人景象:某夜晴空万里,他观测到 2n 颗恒星与月亮。令人惊奇的是,这些恒星恰好可以两两配对,使得每一对恒星中心的连线均经过月亮中心;并且所有这样的连线互不重合。菲隆将这一情形精确绘制于一幅天图之上,并引入了一个坐标系。在绘图过程中,他注意到:所有恒星中心及月亮中心均为整数坐标点。由于菲隆认为地球与月亮是平坦的,他所采用的坐标系为二维平面坐标系。该坐标系由天文学家选定,使得所有天体(包括月亮)的坐标绝对值均不超过 106。此外,任意两个天体(两颗恒星之间,或一颗恒星与月亮之间)均不位于同一点。
除天图外,菲隆还留下一则预言:两千年后,恒星将恰好回到完全相同的位置,但月亮将被一颗巨大的彗星所取代,而这颗彗星将毁灭地球。
如今已是公元2018年。你得到了菲隆的这本古籍,并惊恐地发现:夜空中的恒星位置与两千年前分毫不差!不幸的是,天图的部分区域已遭损毁,目前仅能辨识出部分可见恒星的位置,而恒星的配对方式已不可考;此外,图上亦无任何对应月亮中心的标记点。为查明彗星可能的出现位置、拯救人类免于这场浩劫,你必须立即确定一个满足条件的月亮中心的可能位置!
输入格式
In the first line of input there is an integer n (2 ≤ n ≤ 2600), the number of star pairs seen by an astronomer in the sky.
In the following 2_n_ lines there are pairs of integers x__i, y__i ( - 106 ≤ x__i, y__i ≤ 106), the coordinates of star centers in the sky map. Note that the stars are listed in an arbitrary order that has nothing common with the distribution of stars into pairs as found out by Philon the Berlander. Centers of no two stars coincide.
输入的第一行包含一个整数 n(2≤n≤2600),表示天文学家在天空中观测到的恒星对的数量。
接下来的 2n 行中,每行包含一对整数 xi,yi(−106≤xi,yi≤106),表示天空星图中恒星中心的坐标。注意:这些恒星以任意顺序列出,与伯兰德人菲隆所发现的恒星配对方式无关。任意两颗恒星的中心坐标均不重合。
输出格式
If astronomer was wrong and there is no way to distribute all points in pairs in such manner that all lines passing through these point pairs are distinct lines intersecting in a single point with integer coordinates, and this intersection point is different from centers of all stars, then print "No" (without the quotes) in the only line of input.
Otherwise print "Yes" (without the quotes). In the second line print pair of integers x, y (|x|, |y| ≤ 106), the coordinates of a point that contains a center of the Moon in your solution. If there are several possible answers, output any of them. Note that the printed point should be different from all the star centers.
如果天文学家的结论是错误的,即无法将所有点两两配对,使得所有经过这些点对的直线均为互不相同的直线,且这些直线交于一个具有整数坐标的公共点,同时该交点不同于所有恒星的中心,则在输入的唯一一行中输出“No”(不带引号)。
否则输出“Yes”(不带引号)。在第二行输出一对整数 x, y(满足 ∣x∣,∣y∣≤106),表示你所构造解中月球中心所在的点的坐标。若存在多个可能的答案,输出任意一个即可。注意:所输出的点必须不同于所有恒星的中心。
输入输出样例
输入#1
2 1 1 1 3 3 1 3 3
输出#1
Yes 2 2
输入#2
3 4 2 6 2 2 1 2 6 4 4 6 6
输出#2
Yes 2 2
输入#3
2 1 1 2 2 4 4 5 5
输出#3
No
输入#4
2 1 1 2 1 1 2 2 2
输出#4
No
输入#5
2 0 0 1 1 -1 -1 -1 1
输出#5
No
说明/提示
Pictures for the sample tests are given below.





In the fourth sample test the Moon center could not have possibly been in a point (1.5, 1.5) since the coordinates of this point are non-integer.
In the fifth sample test there are no suitable points that do not coincide with a center of some star.
样例测试的示意图如下所示。





在第四个样例测试中,月球中心不可能位于点 (1.5,1.5),因为该点的坐标不是整数。
在第五个样例测试中,不存在任何满足条件且不与某颗恒星中心重合的点。
输入解题思路,AI测评打分。不知道怎么写?