[20250822] BOJ / G1 / 열쇠 / 이준희 #713
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://www.acmicpc.net/problem/9328
🧭 풀이 시간
100분
👀 체감 난이도
✏️ 문제 설명
벽 / 기밀문서 / 문 / 열쇠 / 복도 가 있는 맵이 있습니다.
각 문에는 그에 맞는 열쇠가 있고 열쇠가 있어야 문을 열어서 들어갈 수 있습니다.
위 맵에 상근이가 침투했을 때 훔칠 수 있는 문서의 최대 갯수를 구하는 문제입니다
🔍 풀이 방법
bfs에 다양한 분기점이 있는 문제였습니다.
처음에는 쌩 구현으로 열쇠를 얻는 등 이벤트마다 맵을 초기화 시켜서 문을 찾아가게 시켰는데, 문을 만나면 대기큐에 넣는 방식으로 시간을 줄였습니다.
⏳ 회고
열쇠를 구하지 못한 문을 방문처리하지 않고 대기 큐에 넣는 방식을 생각하는 것이 굉장히 어려웠습니다.