728x90
반응형
단순한 자료 구조 문제이다. 딕셔너리(해시)로 풀었다.
a, b = map(int, input().split())
A, B = {}, {}
for n in map(int, input().split()):
A[n] = 1
for n in map(int, input().split()):
B[n] = 1
cnt = 0
res = []
for n in A:
if n not in B:
cnt += 1
res.append(n)
print(cnt)
if cnt:
print(*sorted(res))
728x90
반응형
'Agorithm > 백준 알고리즘' 카테고리의 다른 글
백준 알고리즘 10180번 Ship Selection(python) (0) | 2021.03.25 |
---|---|
백준 알고리즘 21185번 Some Sum(python) (0) | 2021.03.24 |
백준 알고리즘 10527번 Judging Troubles(python) (0) | 2021.03.24 |
백준 알고리즘 5568번 카드 놓기(python) (0) | 2021.03.24 |
백준 알고리즘 17608번 막대기(python) (0) | 2021.03.24 |