二分签到题--二分入门

题目如下: Binary Search

For a given sequence A={a0,a1,...,an1}A={a0,a1,...,an−1} which is sorted by ascending order, find a specific value kkgiven as a query.

Input

The input is given in the following format.

nn a0a1,...,an1a0a1,...,an−1 qq k1k1 k2k2 : kqkq

The number of elements nn and each element aiai are given in the first line and the second line respectively. In the third line, the number of queries qq is given and the following qq lines, qq integers kiki are given as queries.

Output

For each query, print 1 if any element in AA is equivalent to kk, and 0 otherwise.

Constraints

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwjjxs.html