Time limit
1s
Memory limit
128 MB
You are given an array of N integers A[1], A[2], ..., A[N]. Write a program that determines whether each query integer X is contained in the array.
The first line contains a natural number N (1 <= N <= 100,000).
The second line contains N integers A[1], A[2], ..., A[N].
The third line contains a natural number M (1 <= M <= 100,000).
The fourth line contains M integers to check. Every integer is at least -2^31 and less than 2^31.
For each of the M query integers, print 1 if it exists in array A and 0 otherwise, one answer per line.