Problem list
Log in
#r03232 · Online Judge > GoldOJ

Find Values (Wide Range)

Silver IV 2.0 s 1024 MB

An array of $n$ distinct integers (values up to $\pm 10^9$) is given, then $k$ query values. For each query print the 1-based position of that value in the array, or -1 if it is not present.

Input

Line 1: $n$. Line 2: $n$ distinct integers in $[-10^9, 10^9]$. Line 3: $k$. Line 4: $k$ query values.

Output

Print the position (or -1) for each query, one per line.

Example 1

Input
6
-1000000000 5 7 0 1000000000 11
4
5 0 -1 1000000000
Output
2
4
-1
5
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code