백준 1269 파이썬
[실버 4] 백준 1269 - 대칭 차집합 (파이썬)
[실버 4] 백준 1269 - 대칭 차집합 (파이썬)
2025.04.02https://www.acmicpc.net/problem/1269풀이A를 집합(set)으로 변환집합을 사용하면 in 연산이 평균 시간 복잡도 O(1)로 빠르게 작동B를 순회하며 A에 포함된 원소 개수를 센다.대칭 차집합 개수 계산print(N + M - 2 * count)시간 복잡도 분석집합 변환 (set) : O(N)B 순회 및 포함 여부 확인 : O(M)최종 연산 : O(1)최종 시간 복잡도 : O(N + M)코드# 백준 1269 - 대칭 차집합# 분류 : 집합N, M = map(int, input().split())A = list(map(int, input().split()))B = list(map(int, input().split()))A = set(A)count = 0for b in B : ..