CF623C.Electric Charges
省选/NOI-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Programmer Sasha is a student at MIPT (Moscow Institute of Physics and Technology) and he needs to make a laboratory work to pass his finals.
A laboratory unit is a plane with standard coordinate axes marked on it. Physicists from Moscow Institute of Physics and Technology charged the axes by large electric charges: axis X is positive and axis Y is negative.
Experienced laboratory worker marked n points with integer coordinates (x__i, y__i) on the plane and stopped the time. Sasha should use "atomic tweezers" to place elementary particles in these points. He has an unlimited number of electrons (negatively charged elementary particles) and protons (positively charged elementary particles). He can put either an electron or a proton at each marked point. As soon as all marked points are filled with particles, laboratory worker will turn on the time again and the particles will come in motion and after some time they will stabilize in equilibrium. The objective of the laboratory work is to arrange the particles in such a way, that the diameter of the resulting state (the maximum distance between the pairs of points of the set) is as small as possible.
Since Sasha is a programmer, he naively thinks that all the particles will simply "fall" into their projections on the corresponding axes: electrons will fall on axis X, while protons will fall on axis Y. As we are programmers too, we will consider the same model as Sasha. That is, a particle gets from point (x, y) to point (x, 0) if it is an electron and to point (0, y) if it is a proton.
As the laboratory has high background radiation and Sasha takes care of his laptop, he did not take it with him, and now he can't write a program that computes the minimum possible diameter of the resulting set. Therefore, you will have to do it for him.
Print a square of the minimum possible diameter of the set.
程序员萨沙是莫斯科物理技术学院(MIPT)的一名学生,他需要完成一项实验作业才能通过期末考试。
实验装置是一个带有标准坐标轴的平面。莫斯科物理技术学院的物理学家在坐标轴上施加了强电荷:X 轴带正电,Y 轴带负电。
一位经验丰富的实验员在平面上标出了 n 个具有整数坐标的点 (xi,yi),并暂停了时间。萨沙需使用“原子镊子”在这些点上放置基本粒子。他拥有无限数量的电子(带负电的基本粒子)和质子(带正电的基本粒子)。他可以在每个已标记的点上放置一个电子或一个质子。一旦所有标记点均被粒子填满,实验员将重新启动时间,粒子随即开始运动,并最终达到稳定平衡态。该实验作业的目标是安排粒子,使得最终状态(即该点集内任意两点间距离的最大值)的直径尽可能小。
由于萨沙是一名程序员,他天真地认为所有粒子将简单地“下落”至对应坐标轴上的投影位置:电子将落在 X 轴上,而质子将落在 Y 轴上。作为同样身为程序员的我们,也将采用与萨沙相同的模型:即一个粒子若为电子,则从点 (x,y) 移动到点 (x,0);若为质子,则移动到点 (0,y)。
由于实验室中存在高强度背景辐射,且萨沙十分爱护自己的笔记本电脑,因此他没有将其带入实验室,现在无法编写程序来计算最终点集的最小可能直径。因此,这项任务就交由你来完成。
请输出该点集最小可能直径的平方。
输入格式
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of points marked on the plane.
Each of the next n lines contains two integers x__i and y__i ( - 108 ≤ x__i, y__i ≤ 108) — the coordinates of the i-th point. It is guaranteed that no two points coincide.
输入的第一行包含一个整数 n(1≤n≤100000)—— 表示平面上标记的点的数量。
接下来的 n 行,每行包含两个整数 xi 和 yi(−108≤xi,yi≤108)—— 表示第 i 个点的坐标。保证任意两个点不重合。
输出格式
Print a single integer — the square of the minimum possible diameter of the set.
输出一个整数——该集合可能的最小直径的平方。
输入输出样例
输入#1
3 1 10 1 20 1 30
输出#1
0
输入#2
2 1 10 10 1
输出#2
2
说明/提示
In the first sample Sasha puts electrons at all points, all particles eventually fall at a single point (1, 0).
In the second sample Sasha puts an electron at point (1, 10), and a proton at point (10, 1). The result is a set of two points (1, 0) and (0, 1), which has a diameter of
.
在第一个样例中,萨沙在所有点上放置了电子,所有粒子最终都落在单个点 (1, 0) 上。
在第二个样例中,萨沙在点 (1, 10) 处放置了一个电子,在点 (10, 1) 处放置了一个质子。结果得到由两个点 (1, 0) 和 (0, 1) 构成的集合,其直径为
。
输入解题思路,AI测评打分。不知道怎么写?