[20250220] SWEA / D4 / 동아리실 관리하기 / 설진영#159
Merged
ShinHeeEul merged 1 commit intomainfrom Feb 20, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
3316. 동아리실 관리하기
🧭 풀이 시간
50분
👀 체감 난이도
✏️ 문제 설명
N일 동안의 동아리 활동에서, 매일 최소 1명은 참여해야 하고 열쇠를 가진 사람과 당일 책임자는 반드시 참여해야 하며, 연속된 날에는 최소 1명의 공통 참여자가 있어야 할 때(열쇠 전달을 위해), 가능한 모든 경우의 수를 구하는 문제 (첫날은 A가 열쇠 보유)
🔍 풀이 방법
dp[bit상태][날짜] 형태의 2차원 배열 사용
bit상태는 1~15까지 사용 (0000(0)은 제외, 모두 불참이므로), 각 상태는 비트마스킹으로 A,B,C,D의 참석여부를 표현
책임자 포함 + 이전날과 공통참석자 있는 상태만 경우의 수 누적
⏳ 회고
규칙 찾기 정말 힘들었는데, 찾으니까 구현은 크게 어렵지 않았음.
그래도 구현하는데 시간이 걸렸어서 연습 많이해야 할 것 같다.
DP는 문제가 장황해도 코드가 짧은 게 묘미인듯