====== 수 찾기 ====== ===== 풀이 ===== * 그냥 기본 문제. * 분류에는 이분 탐색으로 되어있는 것으로 보아, 정렬 후 이분탐색으로 숫자를 찾는 O(mlogn) 해법을 의도한것 같다. 그러나 set을 쓰면 코드도 간단하고 시간도 O(m)으로 더 빠르다. n개의 숫자를 읽어서 set을 만드는 시간까지 포함하면 총 시간복잡도는 O(n+m). ===== 코드 ===== """Solution code for "BOJ 1920. 수 찾기". - Problem link: https://www.acmicpc.net/problem/1920 - Solution link: http://www.teferi.net/ps/problems/boj/1920 """ def main(): N = int(input()) # pylint: disable=unused-variable A = {int(x) for x in input().split()} M = int(input()) # pylint: disable=unused-variable nums = [int(x) for x in input().split()] print('\n'.join(('1' if num in A else '0') for num in nums)) if __name__ == '__main__': main() {{tag>BOJ ps:problems:boj:실버_4}}