#K93852. Loop Detection from Coordinates
Loop Detection from Coordinates
Loop Detection from Coordinates
You are given a sequence of coordinate pairs representing clues on a map. Your task is to determine whether these clues form a closed loop. A closed loop means that starting from the first clue, and following in order, you end up back at the starting point after the last clue.
Formally, given a list of pairs \((x_1, y_1), (x_2, y_2), \ldots, (x_n, y_n)\), the sequence forms a loop if and only if \((x_1, y_1) = (x_n, y_n)\). Note that a single coordinate is considered a loop, and an empty list of clues does not form a loop.
inputFormat
The input begins with a single integer \(n\) representing the number of coordinate pairs. The next \(n\) lines each contain two integers that represent the x and y coordinates of a clue.
If \(n = 0\), then there are no clues.
outputFormat
Print True
if the sequence of clues forms a loop; otherwise, print False
.
4
1 2
2 3
3 4
1 2
True
</p>