P1152 Jolly Jumpers
Description
An integer array with $n$ elements is called a jolly jumper if the absolute differences between each pair of consecutive elements include all integers in $[1, n-1]$. For example, the array $\{1,4,2,3\}$ is a jolly jumper because the absolute differences are $3, 2, 1$.
Given an array, your task is to determine whether it is a jolly jumper.
Input Format
Each test case starts with an integer $n(1 \le n \le 1000)$, followed by $n$ space-separated integers in $[-10^8, 10^8]$.
Output Format
For each test case, output one line. If the array is a jolly jumper, output `Jolly`; otherwise, output `Not jolly`.
Explanation/Hint
$1 \le n \le 1000$
Translated by ChatGPT 5