Solved by 646 users: ...
UserDateAttemptTimeCMSC
Nakilon`12 jan 2010`Ruby300.1145
stasg7`26 nov 2009`Ruby1300.1277
stasg7`27 nov 2009`Ruby1400.1282
stasg7`26 nov 2009`Ruby1200.1283
zhuojie`29 oct 2009`Python103.6985
abortmozga.ru`09 jul 2010`C++1300.2987
stasg7`26 nov 2009`Ruby1100.1288
karthiekc`23 mar 2010`Ruby1300.1490
abortmozga.ru`09 jul 2010`C++1100.2891
abortmozga.ru`09 jul 2010`C++1200.2891
abortmozga.ru`09 jul 2010`C++1000.2895
UlyaNick`21 mar 2009`Ruby100.13101
karthiekc`23 mar 2010`Ruby1200.14109
DAV`23 jun 2009`C++600.37109
WsemirZ`27 dec 2007`Kylix800.13114
WsemirZ`27 dec 2007`Kylix1400.13115
WsemirZ`27 dec 2007`Kylix1500.13115
WsemirZ`27 dec 2007`Kylix1600.13115
Vladislav_Simonenko`20 mar 2006`FPC100.19122
abortmozga.ru`09 jul 2010`C++600.26123
ethanhunt`31 may 2007`C++300.09125
 C++ 315 FPC 177 C 106 Java 30 Kylix 21 Ruby 4 Python 2
` >  >  >  >  >  >  >  >  >  > `

## Reconstructing permutation

Time limit = 3 second(s)

Memory limit = 32000

Petya has shuffled numbers 1,2, .. N and placed them into array A[1..N]. Then he created a new array B[1..N], in which element B[i] represents the number of elements in array A with index >i that are greater than element with index i.

Given array B could you reconstruct initial array A ?

If it is possible you should output array A, otherwise output "-1" without quotes.

Input The number N (1 < N < 10000) folowed by N elements of array B.

Output Elements of array A or "-1".

 Input#1```4 1 1 1 0 ``` Output#1```3 2 1 4 ```
 Input#2```5 2 2 2 2 2 ``` Output#2```-1 ```
 Input#3```10 0 0 0 0 0 0 0 0 0 0 ``` Output#3```10 9 8 7 6 5 4 3 2 1 ```

Author: