PEG 11/12 Programming Test 1 - October 19

Problem 4: Cyclopian Census

FurWear is running out of oxygen!

After an emergency meeting between the Oelfinn and FurWear, and the ingestion of Earth-imported beer, the Oelfinn have decided to contract FurWear to perform analysis on their most recent census data (which now includes Oelfinn living on other planets). The Oelfinn wish to find how old the ith oldest Oelfinn is.

Due to their abnormally long lifespans and quirky reproductive cycles, it is guaranteed that no two Oelfinn will be the same age.

Input

The first line consists of a single integer N (1 < N ≤ 60 000), the number of live Oelfinn. The following N lines each contain a single integer ai (10 ≤ ai ≤ 1 000 000), the age of the ith Oelfinn (in millenia). The next line consists of a single integer Q (1 ≤ Q ≤ 100), the number of queries to follow. The following Q lines each contain a single integer qi (1 ≤ qi ≤ N), the ith query.

Output

Output the correct answer to each query in the order given, on separate lines.

Sample Input

10
42
23
15
52
63
24
73
54
66
10
3
1
5
10

Sample Output

10
42
73

All Submissions
Best Solutions


Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 17, 2011
Author: jargon

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

It's quiet in here...