#include <iostream>
#include <vector>
#include <deque>
using namespace std;
deque<pair<int, int>> dq;
void init()
{
ios_base::sync_with_stdio(false);
std::cin.tie(0);
std::cout.tie(0);
}
int main(void)
{
init();
int N, num;
vector<int> answer;
cin >> N;
for (int i = 0; i < N; i++)
{
cin >> num;
dq.push_back(make_pair(num, i + 1));
}
while (!dq.empty())
{
int this_bloon = dq.front().first;
answer.push_back(dq.front().second);
dq.pop_front();
if(dq.empty()) break;
if (this_bloon > 0)
{
for (int i = 0; i < this_bloon - 1; i++)
{
dq.push_back(dq.front());
dq.pop_front();
}
}
else if (this_bloon < 0)
{
for (int i = 0; i < this_bloon * (-1); i++)
{
dq.push_front(dq.back());
dq.pop_back();
}
}
}
for (int i = 0; i < N; i++)
cout << answer[i] << ' ';
return 0;
}
Coding/BaekJoon