[20251221] BOJ / G5 / 현수막 걸기 / 김민진 #1722
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.
🧷 문제 링크
현수막 걸기
🧭 풀이 시간
50분
👀 체감 난이도
✏️ 문제 설명
말뚝과 깃대가 있고 걸 수 있는 현수막의 최대 넓이가 주어짐
말뚝을 두 개 골라서 그 정가운데 깃대를 세워서 나오는 현수막의 크기 중 최댓값은
🔍 풀이 방법
upperBound
말뚝을 두 개 골라서 세울 수 있는 깃대의 최대 높이를 계산
깃대 정렬 후 이분탐색을 돌리면서 깃대 최대 높이 기준으로 upperBound 진행
target보다 큰 가장 첫 번째 인덱스가 반환되므로 그 -1한 위치의 깃대로 현수막을 세우는 것이 최선
말뚝을 선택하는 모든 경우의 수를 확인해서 가장 큰 현수막의 넓이 구하기
⏳ 회고
3번 이분탐색이었던 것 같음