Algorithms/Algorithms
์ ์ฐพ๊ธฐ (๋ฐฑ์ค 1920๋ฒ, ํด์)
ํฑ์ ค
2021. 11. 4. 15:08
https://www.acmicpc.net/problem/1920
1920๋ฒ: ์ ์ฐพ๊ธฐ
์ฒซ์งธ ์ค์ ์์ฐ์ N(1 ≤ N ≤ 100,000)์ด ์ฃผ์ด์ง๋ค. ๋ค์ ์ค์๋ N๊ฐ์ ์ ์ A[1], A[2], …, A[N]์ด ์ฃผ์ด์ง๋ค. ๋ค์ ์ค์๋ M(1 ≤ M ≤ 100,000)์ด ์ฃผ์ด์ง๋ค. ๋ค์ ์ค์๋ M๊ฐ์ ์๋ค์ด ์ฃผ์ด์ง๋๋ฐ, ์ด ์๋ค
www.acmicpc.net
import sys
input = sys.stdin.readline
n = map(int, input())
a = list(map(int, input().split()))
pool = {}
for k in a:
pool[k] = 1
print(pool)
m = map(int, input())
b = list(map(int, input().split()))
for t in b:
if t in pool:
print(1)
else:
print(0)
728x90