PEG Test '11 - Cyclopian Census

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 16M

Author:
Problem type
PEG 11/12 Programming Test 1 - October 19

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 youngest 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 Specification

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

Output Specification

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

Comments

There are no comments at the moment.