문제출처 : https://www.acmicpc.net/problem/2776
입력을 받은 후 note1을 정렬해준다.
note2에 대하여 이분탐색을 수행한다.
import sys
input = sys.stdin.readline
t = int(input())
def search(s,e,note1, target):
while s<=e:
mid = (s+e) // 2
if note1[mid] == target:
return 1
elif note1[mid] < target:
s = mid + 1
else:
e = mid -1
return 0
def solve():
n = int(input())
note1 = list(map(int,input().split()))
m=int(input())
note2 = list(map(int,input().split()))
note1.sort()
for i in note2:
print(search(0,n-1,note1,i))
for _ in range(t):
solve()