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/1477
🧭 풀이 시간
50 분
👀 체감 난이도
✏️ 문제 설명
좌표 0~L까지의 수평선위에서 n개의 점이 중복없이 이미 정수좌표에 찍혀있다. 그런데, m개의 점을 이제 추가로 찍어서, 모든 점 간의 모든 사이거리들의 최댓값이 최소가 되도록 m개의 점을 적절히 놓았을 때, 사이거리들의 최댓값의 최소를 출력하는 것
🔍 풀이 방법
애초에 문제의 정답인 최댓값을 이분탐색의 left, right, mid값으로 사용함. 이분탐색의 T/F 기준으로
canBuild함수를 만들었고, 이 함수는 임시로 정해진 최댓값이 되도록 가능한지를 판단하는 함수이다.⏳ 회고
이분탐색?
이분탐색의 아이디어를 떠올리기 쉽지않았다. 처음엔 이렇게 생각했다.
정답변수 자체를 이분탐색값으로?
문제의 정답변수 값을 찾기위해 이 것을 이분탐색의 left, right, mid로 하는 컨셉의 문제는 처음이었다. 앞으론
정답 변수자체도 이분탐색의 값이 될 수 있다는 것을 반드시 떠올리자.