[20251024] BOJ / G1 / 통나무 자르기 / 김수연 #1220
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.
🧷 문제 링크
https://www.acmicpc.net/problem/1114
🧭 풀이 시간
120분
👀 체감 난이도
✏️ 문제 설명
통나무 길이 L이고, K개의 위치에서만 자를 수 있고, 자를 수 있는 횟수는 최대 C번 일때,
통나무의 가장 긴 조각을 작게 만들고, 그 길이를 구하기
🔍 풀이 방법
이분탐색 + 누적합 사용
가장 긴 조각의 길이를 이분 탐색으로 탐색하고, 돌리면서 mid를 넘을 때 잘라줌 그리고 한 구간이 그냥 mid보다 크면 무조건 C+1로 바꾸면서 mid 길이 늘림
그리고 자른 횟수가 최대 횟수 C보다 작으면 그냥 제일 앞의 구간 잘라줌
⏳ 회고
아오 걍 너무 어려움.. 다시 풀어도 또 힌트봤다......아오...