[백준 1920][Python] 수 찾기

봉글렛·2023년 3월 26일

백준

목록 보기
51/55

문제 링크 https://www.acmicpc.net/problem/1920

탐색 시간을 줄이기위해 set을 사용했다.

풀이

import sys

sys.stdin.readline()
# set으로 받으면 탐색시간이 줄어듦
a = set(sys.stdin.readline().split())
sys.stdin.readline()
b = [*sys.stdin.readline().split()]
for i in b:
    if i in a:
        print(1)
    else:
        print(0)
profile
어쩌다 개발자 (할 수 있을 때까지!!!!)

0개의 댓글