https://www.acmicpc.net/problem/1138
#include <iostream>
using namespace std;
int n;
const int MAX = 10;
int arr[MAX];
int res[MAX] = {0, };
// 행렬
void solution(){
for(int i=0;i<n;i++){
int idx = arr[i];
int cnt = 0;
for(int j=0;j<n;j++){
if(res[j] == 0){
if(cnt == idx){
res[j] = i+1;
break;
}
cnt++;
}
}
}
}
#include <cstdio>
int main(void) {
int n;
int temp;
int line[10]{};
size_t pos;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &temp);
pos = 0;
while (line[pos])
pos++;
while (temp--)
while (line[++pos]);
line[pos] = i;
}
for (int i = 0; i < n; i++)
printf("%d ", line[i]);
return 0;
}