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