An array a
of n integers between 0 and n-1 is given.
The answer is a permutation of (0,...,n-1) such that:
a_0 + h_0 <= a_1 + h_1 <= ... <= a_n-1 + h_n-1 <= n-1
n <= 60
and the answer is unique.
For example if a
is (0,2,4,2,0) the answer (h
) is uniquely determined(as the problem promised):
h = (3,1,0,2,4)