Submit | All submissions | Best solutions | Back to list |
PESADA02 - Search for an integer in a list of integers |
Search for an integer in a list of integers.
Input
The input begins with the positive integer n of number of integers in the list in a single line (1 <= n <= 1000000). Each integer (-1000000 < integer < 1000000) of the list are in a single line. After a blank line a single line has the number t of integers to be searched one after the other (1 <= t <= 100000) followed by t integers one in each single line.
Output
For each integer to be searched in n integers, print the index (0 <= index <= n-1) at which the integer to be searched appears first time in the list; print -1 if the the search is unsuccessful.
Example
Input: 4
999999
0
-999999
1234
6
123
1234
-1234
0
999999
999999 Output: -1
3
-1
1
0
0
Added by: | Prof. Channa Bankapur |
Date: | 2015-01-18 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C |