less than 1 minute read

문제링크

숫자 입력 받은 후

중복 제거하기

set 으로 중복 제거

note2[i]가 note1 안에 존재한다면 1 출력 하지않는다면 0출력

파이썬

import sys
input = sys.stdin.readline
n = int(input())
for _ in range(n):
    m = int(input())
    note1 = list(map(int,input().split())) 
    m2 = int(input())
    note2 = list(map(int,input().split()))
    note1 = set(note1)



    for i in range(m2):
        
        if note2[i] in note1:
            print(1)
        else:
            print(0)


카테고리:

업데이트:

댓글남기기