| UNICAMP Freshman Contest 2025 |
|---|
| Finished |
A professor of analytic geometry (MA141) is worried because he can only think of homothety problems to put on his second exam (P2). Therefore, he threatens a turtle from IMECC to get an easy problem.
The turtle, afraid of losing its head by being swallowed, suggests the following problem: "Given four points in the Cartesian plane $$$A, B, C, D$$$. The task is to determine whether these four points form a square with sides $$$AB$$$, $$$BC$$$, $$$CD$$$, and $$$DA$$$."
The professor gladly accepted the turtle's suggestion, and everyone lived happily ever after.
The input consists of four lines, each containing two integers separated by a space $$$x$$$ and $$$y\;(-10^4 \leq x, y \leq 10^4)$$$, representing the coordinates of points $$$A, B, C$$$, and $$$D$$$. It is guaranteed that there are no coincident points among $$$A$$$, $$$B$$$, $$$C$$$, and $$$D$$$.
Print "SIM" (portuguese for YES) if the four points form a square with sides $$$AB$$$, $$$BC$$$, $$$CD$$$, and $$$DA$$$, and "NAO" (portuguese for NO) otherwise.
0 00 11 11 0
SIM
1 01 10 10 0
SIM
0 00 11 21 1
NAO
1 02 11 20 1
SIM
1 01 22 10 1
NAO
Note that the sides of the square do not need to be parallel to the axes, as shown in the fourth example.
Hint: Floating point operations may cause precision errors. Try to do everything with integers.
| Name |
|---|


