Problem1463--Numbers Finding

1463: Numbers Finding

Time Limit: 4 Sec  Memory Limit: 128 MB
Submit: 28  Solved: 17
[Submit] [Status] [Web Board] [Creator:]

Description

Write a program to find a number x in the sorted input array a[].

Input

The number of elements (n) of array a[] and the number of x values to find (m) are entered in the first line.
Then, n integers (a[i]) are entered in ascending order on the next line, and from the next line, m values of x are entered, one per line.
(5 <= n <= 50,000, 0 <= a[i] < 100,000)
(1 <= m <= 100,000, 0 <= x < 100,000)

Output

For each x, print true if x exists in array a[], otherwise print false, one per line.

Sample Input Copy

5 4
1 2 2 3 4
1
5
10
2

Sample Output Copy

true
false
false
true

Source/Category