public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = Integer.parseInt(in.nextLine().trim()); String[] str = in.nextLine().trim().split(" "); int[] arr = new int[n]; for (int i = 0; i < arr.length; i++) { arr[i] = Integer.parseInt(str[i]); } int[] res = new int[n]; boolean[] marked = new boolean[n]; int cnt = 0; while (cnt < n) { // 从后往前找,遇到 0 就标记为最矮的,否则就减 1 (代表前面为 0 的已经被标记,剔除) for (int i = arr.length - 1; i >= 0; i--) { if (marked[i]) continue; if (arr[i] == 0) { res[i] = ++cnt; marked[i] = true; break; } else { arr[i] -= 1; } } } for (int i = 0; i < res.length; i++) { System.out.print(res[i] + " "); } }