[20251017] BOJ / G2 / 구간 자르기 / 김수연 #1149
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/2283
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
각 구간에서 A와 B 사이에 포함되지 않은 부분을 모두 잘라냈을 때 남는 부분들의 길이 총합이 K가 되는 구간 A, B의 최솟값 구하기
🔍 풀이 방법
누적합 + 투포인터 사용
누적합으로 각 지점에 몇개의 구간이 포함되어 있는지 미리 계산해두고,
투 포인터로 start랑 end 옮기면서 길이 총합이 K가 되는 지점 찾음
⏳ 회고
어렵다..