PS/Python
[BOJ/Python] 10815 - 숫자 카드
이분 탐색으로 풀었는데, 다른 풀이를 보니 set를 사용한 풀이가 통과돼서 좀 황당했던 문제... 내가 문제 조건의 이해를 잘못한건가? 아니면 list보다 set를 비교 대상으로 할 때 더 빠른 건가? 잘 모르겠다. 방법 1. set # 684ms / 119412KB from sys import stdin, stdout n = int(stdin.readline()) a = set(map(int, stdin.readline().split())) m = int(stdin.readline()) b = list(map(int, stdin.readline().split())) for i in b: print(1,end=' ') if i in a else print(0,end=' ') 방법 2. 이분 탐색 # 27..
2020. 7. 7. 17:46
최근댓글