Algorithms
백준 1269. 대칭 차집합
Brian Go
2022. 6. 7. 04:07
파이썬은 신이다. 나는 무적이고.
파이썬의 내장 집합 자료형으로 매우 간단하게 풀 수 있다. 차집합은 집합 간 - 연산으로 간단히 구할 수 있고, 합집합 또한 union 메서드를 통해 간단하게 구현할 수 있다.
n, m = map(int, input().split())
s1 = set(map(int, input().split()))
s2 = set(map(int, input().split()))
print(len((s1 - s2).union((s2 - s1))))
