A11908 | Photo of The Sky
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.
Strictly speaking, it makes a photo of all points with coordinates $(x, y)$ , such that $x_1 \leq x \leq x_2$ and $y_1 \leq y \leq y_2$ , where $(x_1, y_1)$ and $(x_2, y_2)$ are coordinates of the left bottom and the right top corners of the rectangle being photographed. The area of this rectangle can be zero.
After taking the photo, Pavel wrote down coordinates of $n$ of his favourite stars which appeared in the photo. These points are not necessarily distinct, there can be multiple stars in the same point of the sky.
Pavel has lost his camera recently and wants to buy a similar one. Specifically, he wants to know the dimensions of the photo he took earlier. Unfortunately, the photo is also lost. His notes are also of not much help; numbers are written in random order all over his notepad, so it's impossible to tell which numbers specify coordinates of which points.
Pavel asked you to help him to determine what are the possible dimensions of the photo according to his notes. As there are multiple possible answers, find the dimensions with the minimal possible area of the rectangle.
Strictly speaking, it makes a photo of all points with coordinates $(x, y)$ , such that $x_1 \leq x \leq x_2$ and $y_1 \leq y \leq y_2$ , where $(x_1, y_1)$ and $(x_2, y_2)$ are coordinates of the left bottom and the right top corners of the rectangle being photographed. The area of this rectangle can be zero.
After taking the photo, Pavel wrote down coordinates of $n$ of his favourite stars which appeared in the photo. These points are not necessarily distinct, there can be multiple stars in the same point of the sky.
Pavel has lost his camera recently and wants to buy a similar one. Specifically, he wants to know the dimensions of the photo he took earlier. Unfortunately, the photo is also lost. His notes are also of not much help; numbers are written in random order all over his notepad, so it's impossible to tell which numbers specify coordinates of which points.
Pavel asked you to help him to determine what are the possible dimensions of the photo according to his notes. As there are multiple possible answers, find the dimensions with the minimal possible area of the rectangle.
输入格式
The first line of the input contains an only integer $n$ ( $1 \leq n \leq 100\,000$ ), the number of points in Pavel's records.
The second line contains $2 \cdot n$ integers $a_1$ , $a_2$ , ..., $a_{2 \cdot n}$ ( $1 \leq a_i \leq 10^9$ ), coordinates, written by Pavel in some order.
The second line contains $2 \cdot n$ integers $a_1$ , $a_2$ , ..., $a_{2 \cdot n}$ ( $1 \leq a_i \leq 10^9$ ), coordinates, written by Pavel in some order.
输出格式
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
输入输出样例
输入 #1
4 4 1 3 2 3 2 1 3
输出 #1
1
输入 #2
3 5 8 5 5 7 5
输出 #2
0
In the first sample stars in Pavel's records can be $(1, 3)$ , $(1, 3)$ , $(2, 3)$ , $(2, 4)$ . In this case, the minimal area of the rectangle, which contains all these points is $1$ (rectangle with corners at $(1, 3)$ and $(2, 4)$ ).
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted