#P1918. 保龄球
保龄球
Description
DL is tired of fortune-telling, so he often goes to the gym to bowl for fun. Since he has been bowling for decades, technique is not a problem, and he wants to try something new.
DL’s eyesight is really good. He can actually count the number of pins at each spot about ten meters ahead of him. He suddenly realizes this is a chance to show off—after seeing the exact number of pins at each position, he throws from a certain position so that he can knock down a certain number of pins.
- ○ ○ ○
- ○ ○ ○ ○
- ○
- ○ ○
As shown above, each “○” represents one pin. If DL wants to knock down pins, he throws from position ; if he wants to knock down pins, he throws from position .
Now he wants to knock down pins. He tells you the number of pins at each position. Please give him a throwing position.
Input Format
The first line contains a positive integer , the number of positions.
The second line contains positive integers , where is the number of pins at position . It is guaranteed that the numbers of pins at all positions are distinct.
The third line contains a positive integer , the number of DL’s throws.
From the fourth line to the end of file, each line contains a positive integer , the number of pins DL wants to knock down.
Output Format
Output lines. Each line contains one integer: the position of DL’s -th throw. If there is no solution, output .
5
1 2 4 3 5
2
4
7
3
0
Hint
Constraints
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号