프로그램 명: coci_ogledala
제한시간: 4 초

There are M modern washbasins numbered from 1 to M from left to right in the ladies’ room of an enormous shopping centre.

Currently, there are N ladies in the restroom (numbered from 1 to N) and they’ve occupied the washbasins with numbers A1, A2, . . . , AN . Soon there will be M ? N more ladies arriving (numbered from N + 1 to M in the order of arrival) that will occupy all the remaining available washbasins. The ladies arriving primarily want their privacy, so each of them always chooses an available washbasin by the following procedure:

It is safe to assume that none of the ladies will leave the washbasin in the foreseeable future.

Write a programme that will, for each of Q given integers Bi , determine the label of the washbasin that will be occupied by the lady marked with Bi .

입력

The arrays A and B are strictly increasing. In other words, it holds 1 <= A1 < A2 < . . . < AN <= M and 1 <= B1 < B2 < . . . < BQ <= M.

출력

Output Q lines. The i-th line must contain the label of the washbasin that will be used by the lady labeled Bi .

Please note: We recommend that you use a 64-bit integer data type (int64 in Pascal, long long in C/C++).

입출력 예

입력

7 1 4
4
2 3 4 5

출력

2
6
1
3

입력

10 2 4
2 8
1 3 5 8

출력

2
5
6
4

Clarification of the second example: The first two ladies occupy the washbasins 2 and 8 (respectively).
The remaining ladies occupy the washbasins 5, 3, 6, 9, 1, 4, 7 and 10, respectively.
출처:2013-2014/olympiad 3/4

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]