[20250723] BOJ / G4 / 숨바꼭질 2 / 이준희 #528
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/12851
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
좌표평면 상에 수빈이와 동생이 있고 수빈이는 매 초 +1칸 / -1칸 / *2의 위치로 순간이동 할 수 있을 때 수빈이가 동생한테 도달할 수 있는 가장 빠른 시간과 그 때의 가짓수를 구하는 문제입니다.
🔍 풀이 방법
처음에는 큐 단위로 시간을 계산하며 BFS하는 방식으로 구현하였는데 중복을 허용하는 과정에서 큐에 너무 많은 중복값이 들어가서 시간초과가 발생했습니다.
그래서 다른 방법을 생각해보다가 time 배열과 count 배열을 각각 두어서 중복되는 경우에는 큐에 한번만 넣고 가짓수는 따로 세는 방법으로 풀이했습니다.
⏳ 회고
일반적인 BFS로 접근했다가 만나는 시간초과 해결에 시간을 많이 소모했던 것 같습니다. 다양한 접근 방식을 떠올릴 수 있는 말랑한 뇌를 가지도록 노력해야겠습니다.