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/1981
🧭 풀이 시간
17분
👀 체감 난이도
✏️ 문제 설명
N*N 격자에서 상하좌우 이동으로 (1,1)에서 (N,N)까지 도달하는 경로에 적힌 수들의 (max-min) 중 최소를 구해보자.
🔍 풀이 방법
[사용한 알고리즘]
0 ~ limit까지의 수들만 거쳐서 도달 가능한지 확인하는 BFS함수를 짰다.
=> limit를 이분 탐색으로 조정하며 limit의 최소를 찾아준다.
이후, 맵 전체를 -1하고 위 과정을 다시 반복한다.
이걸 A[0][0]이 음수가 되기 전까지 반복한다.
⏳ 회고
예전에 틀렸던 문젠데, 그 때는 말도 안 되는 이상한 BFS를 짜서 틀렸던 거 같다.