https://www.acmicpc.net/problem/1920
def bin_search(a,key):
start=0
end=len(a)-1
while start<=end:
mid=(start+end)//2
if key==a[mid]:
return 1
elif key>a[mid]:
start= mid+1
else:
end=mid-1
if start > end:
return 0
n=int(input())
N=list(map(int,input().split()))
N.sort()
m=int(input())
M=list(map(int,input().split()))
for i in range(0,m):
print(bin_search(N,M[i]))
댓글