목록비트마스킹 (6)
기록방
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bCJtRU/btrKvRd5bKo/RahnrQZqgS9oZQcIMtcuZ0/img.png)
👉 문제링크 11723번: 집합 첫째 줄에 수행해야 하는 연산의 수 M (1 ≤ M ≤ 3,000,000)이 주어진다. 둘째 줄부터 M개의 줄에 수행해야 하는 연산이 한 줄에 하나씩 주어진다. www.acmicpc.net 🔸 문제 분석 🔸 set를 구현하는 문제이다. 🔸 코드 🔸 import sys m = int(sys.stdin.readline()) s = set() for i in range(m): order = sys.stdin.readline() if order[:3] == "add": s.add(int(order[4:])) elif order[:6] == "remove": x = int(order[7:]) if x in s: s.remove(x) elif order[:5] == "check": ..
CodingTest/Python
2022. 8. 25. 15:10