[CF1208D] 前缀小于之和还原排列 (Restore Permutation)
Problem Statement
Let be a permutation of integers through . For each , let be the sum of all elements with and .
Given the valid array , reconstruct the unique permutation .
Input
The first line contains (). The second line contains integers . It is guaranteed that a valid permutation exists.
Output
Print integers .
Example
4
0 0 2 0
4 2 3 1
Note
- Constraints:,保证输入对应唯一合法排列。
- Source:Codeforces 1208D · Restore Permutation