#CCBCHBAHAI0000113. Lost Lineup
Lost Lineup
Lost Lineup
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem
Person 1 (Jimmy) is first. For each person , is the number of people between that person and Jimmy. Hence its 1-based position is , equivalently ans[d_i+1]=i in a 0-based array. The distances form a permutation of .
Input
The first line contains . If , the next line contains .
Output
Print the reconstructed lineup.
Subtask
Subtask 1 (20 points): .
Subtask 2 (30 points): .
Subtask 3 (50 points): .
Example
Input
4
1 2 0
Output
1 4 2 3
Explanation
Distance 0 is immediately behind Jimmy; the other distances determine the remaining positions.