A10220 | Electric Charges
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
The first line of the input contains a single integer $n$ ( $1<=n<=100000$ ) — the number of points marked on the plane.
Each of the next $n$ lines contains two integers $x_{i}$ and $y_{i}$ ( $-10^{8}<=x_{i},y_{i}<=10^{8}$ ) — the coordinates of the $i$ -th point. It is guaranteed that no two points coincide.
Each of the next $n$ lines contains two integers $x_{i}$ and $y_{i}$ ( $-10^{8}<=x_{i},y_{i}<=10^{8}$ ) — the coordinates of the $i$ -th point. It is guaranteed that no two points coincide.
输出格式
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 .
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 .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted