P26721 [AtCoder] Sugoroku and Pieces
普及+
题目描述

Problem Description

JOI-kun has a sugoroku board. This sugoroku board consists of 2019 squares arranged in a single row. These squares are numbered from 1 to 2019, starting from the leftmost starting square to the rightmost goal square.

Currently, there are $ N $ pieces placed on this sugoroku board. These pieces are numbered from 1 to $ N $ in order from the closest to the starting square. Piece $ i $ ($1 \leq i \leq N$) is placed on square $ X_i $. All pieces are placed on different squares.

JOI-kun will perform $ M $ operations. In the $ j $-th operation ($1 \leq j \leq M$), he will move piece $ A_j $ one square forward. However, if the original square is the goal square, or if another piece is already on the destination square, piece $ A_j $ will not move and remain in its position.

Determine the squares where each piece is located after all operations are completed.

Input Format

The input is given from the standard input in the following format:

$ N $ $ X_1 $ $ X_2 $ $ ... $ $ X_N $ $ M $ $ A_1 $ $ A_2 $ $ ... $ $ A_M $

Output Format

Output $ N $ lines. The $ i $-th line ($1 \leq i \leq N$) should contain the number of the square where piece $ i $ is located after all operations are completed.

Sample Input and Output

Sample Input #1

3
2 3 6
2
1 3

Sample Output #1

2
3
7

Sample Input #2

2
1 2016
4
2 2 2 2

Sample Output #2

1
2019

Sample Input #3

4
1001 1002 1003 1004
7
1 2 3 4 3 2 1

Sample Output #3

1002
1003
1004
1005

Notes/Hints

Constraints

  • $1 \leq N \leq 100$
  • $1 \leq X_1$
  • $1 \leq M \leq 100$
  • $1 \leq A_j \leq N$ ($1 \leq j \leq M$)

Sample Explanation 1

In the first operation, piece $ 1 $ attempts to move from square $ 2 $ to square $ 3 $. However, piece $ 2 $ is already on square $ 3 $, so piece $ 1 $ does not move. In the second operation, piece $ 3 $ moves from square $ 6 $ to square $ 7 $. After all operations are completed, piece $ 1 $ is on square $ 2 $, piece $ 2 $ is on square $ 3 $, and piece $ 3 $ is on square $ 7 $.

Sample Explanation 2

After the third operation, piece $ 2 $ is on square $ 2019 $. Therefore, in the fourth operation, piece $ 2 $ does not move.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 2 3 6 2 1 3
样例输出
2 3 7