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://www.acmicpc.net/problem/12851
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
수빈이는 걷거나 순간이동할 수 있는데, 걷는 경우 1초 후에 위치가 X-1 혹은 X+1로 이동하며, 순간이동은 1초 후에 위치가 2*X가 된다.
수빈이가 동생을 찾는 가장 빠른 시간과, 그 시간으로 찾는 방법의 수를 구하는 문제
🔍 풀이 방법
BFS를 사용해 각 위치에 도달하는 최소 시간을 구함
visited 배열에는 해당 위치를 방문한 최소 시간을 기록하며, 같은 최소 시간에 여러 경로가 도달할 수 있으므로, 이를 처리하기 위해 visited[next] == time + 1인 경우도 큐에 넣어 방법 수 세기
동생 위치에 도달할 때마다 최소 시간을 갱신하거나, 같은 시간에 도달하면 방법 수를 증가
⏳ 회고
최소 시간과 경로 수 한번에 구하는 문제, 생각보다 햇갈렸지만 크게 어려운 건 없었음