Geometry
Geometry-05
Geometry-06
Geometry-07
~/algor $ cat problems/kvadrat-tort-nuqta
Are four points a square?
Easy
1000 ms
128 MB
31%
Four points are given on the plane in arbitrary order. Can they be the vertices of a square of positive area? (The sides of the square need not be parallel to the coordinate axes.) If so, print YES, otherwise print NO.
Input
Each of the four lines contains two integers — the coordinates of a point.
Output
YES or NO.
Note
$-10^{9} \le x_{i}, y_{i} \le 10^{9}$
Examples
Input #1
1 1 4 2 0 4 3 5
Output #1
YES
Input #2
0 0 2 0 2 1 0 1
Output #2
NO