#P3988. [SHOI2013] 发牌

    ID: 2859 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>模拟2013线段树各省省选平衡树树状数组上海主席树

[SHOI2013] 发牌

Description

In some poker games, such as Texas hold'em, dealing has its own rules. The professional dealer is commonly called the dealer. Before dealing, the dealer needs to burn a card (burn card). Burning means moving the current top card of the deck to the bottom of the deck. This helps prevent players from guessing cards and affecting the game.

Suppose at the start, the dealer takes out a new deck with NN distinct cards labeled from 11 to NN. Since it is a new deck, the cards are in order from the top of the deck as 1,2,,N1, 2, \cdots, N, with card NN at the bottom. To deal all cards, the dealer performs NN dealing operations. Before the ii-th deal, he performs RiR_i consecutive burn operations, where RiR_i is given in the input. What is the final order of the cards received by the player?

For example, suppose N=4N=4. Initially, the deck order is 1,2,3,41,2,3,4.

  • Suppose R1=2R_1=2. The dealer burns twice, moves 11 and 22 to the bottom, then deals 33 to the player. The current deck order is 4,1,24,1,2.
  • Suppose R2=0R_2=0. The dealer does not burn and directly deals 44 to the player. The current deck order is 1,21,2.
  • Suppose R3=3R_3=3. The dealer burns 1,2,11,2,1 in order, then deals 22 to the player. The deck now has only one card left, 11.
  • Suppose R4=2R_4=2. After burning 11 twice again, the dealer still deals 11 to the player because 11 is the only card in the deck.

Input Format

The first line contains an integer NN, the number of cards.

From the second line to line N+1N+1, the (i+1)(i+1)-th line contains an integer RiR_i.

Output Format

Output NN lines. On the ii-th line, output one integer, the label of the ii-th card received by the player.

4
2
0
3
2
3
4
2
1

Hint

Constraints

For 100%100\% of the testdata, 0Ri<N0 \le R_i < N.

Test point ID N=N= Test point ID N=N=
11 5×1035\times 10^3 66 3×1053\times 10^5
22 10410^4 77 4×1054\times 10^5
33 5×1045\times 10^4 88 5×1055\times 10^5
44 10510^5 99 6×1056\times 10^5
55 2×1052\times 10^5 1010 7×1057\times 10^5

Translated by ChatGPT 5