【C_W_L】的矩形

TimeLimit:1000MS  MemoryLimit:256MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

图片.png



从前有个人叫【C_W_L】,他想在他家后花园盖了一个长方形游泳池(这是真的奢侈)

他在他家后花园弄了个坐标轴,然后画了几个点,结果他的朋友Morning_X过来搞鬼擦去了几个点。


现在已知剩下的n个点,请问你能否帮他恢复这个矩形


Input

The first line of the input contains a single integer n (1 ≤ n ≤ 4) — the number of vertices that were not erased by Wilbur's friend.

Each of the following n lines contains two integers xi and yi ( - 1000 ≤ xi, yi ≤ 1000) —the coordinates of the i-th vertex that remains. Vertices are given in an arbitrary order.

It's guaranteed that these points are distinct vertices of some rectangle, that has positive area and which sides are parallel to the coordinate axes.


第一行有一个整数n (1 ≤ n ≤ 4) 。代表没被Morning_X擦去的点的数量。

接下来有n行,每行有2个整数xiyi ( - 1000 ≤ xi, yi ≤ 1000) ,代表第i个顶点的坐标,顶点以任意顺序给出

保证这些点一定是不同的且矩形面积为正

Output

Print the area of the initial rectangle if it could be uniquely determined by the points remaining. Otherwise, print  - 1.


如果他可以唯一确定剩下的点则输出矩形的面积,如果不能则输出-1

SampleInput 1
2
0 0
1 1
SampleOutput 1
1
SampleInput 2
1
1 1
SampleOutput 2
-1
Note

In the first sample, two opposite corners of the initial rectangle are given, and that gives enough information to say that the rectangle is actually a unit square.

In the second sample there is only one vertex left and this is definitely not enough to uniquely define the area.

Submit
题目统计信息详细
总AC数29
通过人数26
尝试人数32
总提交量84
AC率30.95%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: