반응형
10815번: 숫자 카드
첫째 줄에 상근이가 가지고 있는 숫자 카드의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 숫자 카드에 적혀있는 정수가 주어진다. 숫자 카드에 적혀있는 수는 -10,000,000보다 크거나 같고, 10,
www.acmicpc.net
리스트에서 탐색하는 것 보다 딕셔너리 키 탐색이 더 빠르다.
# @Author YoungMinKim
# baekjoon
import sys
a= int(sys.stdin.readline())
X = list(map(int,sys.stdin.readline().split()))
b = int(sys.stdin.readline())
Y = list(map(int,sys.stdin.readline().split()))
dic = {}
for i in X:
dic[i] = True
for i in Y:
if i in dic:
print(1,end=' ')
else:
print(0,end=' ')
반응형
'백준 문제풀이' 카테고리의 다른 글
| baekjoon - python - 10845 (0) | 2020.10.10 |
|---|---|
| baekjoon - python - 1920 (0) | 2020.10.10 |
| baekjoon - python - 10867 (0) | 2020.10.10 |
| baekjoon - python - 1927 (0) | 2020.10.04 |
| baekjoon - python - 11279 (0) | 2020.10.04 |
댓글