UVa 10038 - Jolly Jumpers

10038 - Jolly Jumpers

 * http://acm.uva.es/p/v100/10038.html

Summary
Determine if the absolute values of the difference between successive elements take on all the values 1 through n-1.

Explanation
 Create a set For each number, calculate the absolute difference between it and its predecessor and add the difference to the set If the size of the set is n-1, output "Jolly"  

Gotcha's

 * The size of the input (3000) is on the large-ish size
 * Make sure the differences are all between 1 and n-1

Input
4 1 4 2 3 5 1 4 2 -1 6

Output
Jolly Not jolly