The first line contains an integer, representing the number of people in the queue.
The second line containsintegers
, representing the current patience value of the
preson.
Outputintegers in one line, denoting the order in which
people leave.
In the first round, the patience value of people who's still in the queue is
. Their patience value and the queue is changed as the way follows:
;
, and since
is reduced to
, the
person leaves the queue;
, after
person left, the rank of
person has changed to
, so his patience value is reduced by
in this round;
;
.
In the second round, their patience value is reduced as the way follows:
, the
person leaves the queue;
;
, the
person leaves the queue;
, the
person leaves the queue.
And finally, in the fifth round, the patience value of
person is reduced to
, and he leaves the queue. So the order in which
people leave in the example is
.