#K84167. Unique Adjacent Sum Circle Arrangement
Unique Adjacent Sum Circle Arrangement
Unique Adjacent Sum Circle Arrangement
You are given n friends, each with a specified age. Your task is to determine whether it is possible to arrange these friends in a circle such that the sum of the ages of every pair of adjacent friends is unique.
Formally, let \(a_1, a_2, \dots, a_n\) denote the ages arranged in a circle. Then, the sums \[ a_1+a_2, \quad a_2+a_3, \quad \dots, \quad a_{n-1}+a_n, \quad a_n+a_1 \] must all be distinct.
If \(n = 2\), note that if the two ages are identical, the single adjacent sum cannot be unique.
inputFormat
The first line contains an integer \(n\) denoting the number of friends. The second line contains \(n\) space-separated integers representing the ages of the friends.
outputFormat
Print a single line: "Possible" if there exists an arrangement such that the sum of the ages of every two adjacent friends is unique, otherwise print "Impossible".
## sample4
18 22 20 24
Possible
</p>