[백준/Python] 10815번 : 숫자 카드

문제

https://www.acmicpc.net/problem/10815

풀이

input의 수가 큰 경우이기 때문에 딕셔너리 자료형을 활용하여 해를 구하였다.

import sys
input = sys.stdin.readline

# dictionary
h = {}

# number of cards
N = int(input())

for i in map(int, input().split()):
    h[i] = 1

M = int(input())

for i in map(int, input().split()):
    if i in h.keys():
        print(1, end=" ")
    else:
        print(0, end=" ")