Merged
Conversation
Contributor
|
count가 머지? 나랑 풀이가 다른 거 같아서 이해를 못함 |
Contributor
Author
특정 칸은 여러번 도달할 수 있지만, 그 여러번엔 제한이 있다고 생각한거야. |
Contributor
어디서 왔는지는 고려 안하고 단순히 방문 횟수만 체크하는 건가? 이게 왜 맞는지는 모르겠네 |
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/16930
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
BFS에서 한 칸씩 이동하는 게 아니라 K칸씩 이동할 수 있을 때, 최단 시간은?
🔍 풀이 방법
BFS이지만 한 칸을 최대 4번 도달할 수 있어서, 그 부분을 체크해야 함
그것만 하면 기본 BFS와 같음
⏳ 회고
BFS는 가중치가 같을 때, 다익스트라보다 빠르다.$O(V+E)$ $O((V+E)logV)$
BFS의 시간복잡도:
다익스트라의 시간복잡도:
그리고 count를 4로 했어야 했는데, 그냥 직감(찍었다고 해야하나)으로 4방향이면 왔다 갔다가 있을 수 있어서 2로 제한했는데도 맞았다.
실제 코테에선 4로 풀어야겠다.
근데 2로 해도되나? @oncsr