[20250223] SWEA / D4 / 동아리실 관리하기 / 이강현 #168
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWBnFuhqxE8DFAWr
🧭 풀이 시간
2일
👀 체감 난이도
✏️ 문제 설명
N일 동안 동아리실에서 A,B,C,D가 참가하는 경우의 수를 구하자. 입력으로 매일 꼭 참가해야 하는 책임자 한명이 주어지고 문을 열고 닫기 위한 키를 이전에 참가했던 팀원 중 한명에게 전달 받아야 한다.
🔍 풀이 방법
핵심은 전날 참가했던 참가자 조합과 오늘 참가하는 참가자 조합의 교집합이 0이 되어서는 안된다는 것을 이용한다. 매일 주어지는 책임자 한명을 통해 부분집합을 모두 만들고 오늘 날짜의 모든 조합 각각을 이전 날짜의 모든 조합과 비트연산하여 0이 아닌 경우에만 이전 날짜의 경우의 수를 오늘 날짜의 경우의 수에 반영하도록 구현하였다.
⏳ 회고
비트마스킹이 문제에 적용되니 자꾸 헷갈렸고 또 dp가 섞여있는 문제라서 많이 어려웠던 것 같다.