提示: 欢迎访问OurACM平台。
Problem 1879 Air Strike

Accept: 83    Submit: 330
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

The ACM kingdom has suffered a heavy air strike!Many of the buildings has been destroyed.

To start the reconstruction,the government wants to know something about the ‘lucky buildings’ (buildings free from being destroyed).

The original buildings in ACM kingdom are located in a line, continuous numbered start from 1 and here we assume the buildings is infinite.

Now you will be given the list of destroyed buildings,you are required to find the original serial number of the kth ‘lucky building’ after air strike.

Input

There are multiple cases, for each case,

First line is the number of destroyed building N (0 <= N <= 50000)

Then following N numbers (X1,X2,…XN) that Xi (1 <= Xi <= 10^8) is the original serial number of the destroyed building.

Then give out the number of inquiries M (1 <= M <= 50000).

Then following M numbers (K1,K2,…KM) that Ki (1 <= Ki <= 10^8) is the serial number of the 'lucky building'.

There may be one or more blank lines between each input case.

Output

For each case,

for each query Ki, just output the original serial number of the Ki th 'lucky building'.

output a blank line after each case

Sample Input

3 2 2 4 3 1 2 2 0 1 1

Sample Output

1 3 3 1

Source

code6

Submit  Back  Status  Discuss