[20250831] BOJ / G5 / 개똥벌레 / 이강현 #786
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/3020
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
석순과 종유석이 번갈아가며 나타나는 동굴이 있음.
개똥벌레가 특정 높이에서 일직선으로 부수면서 지나갈거임.
최소의 개수로 석순 혹은 종유석을 부수면서 지나갈때 그 개수와 최소로 부수게 되는 높이의 수를 출력
🔍 풀이 방법
누적합
입력시 석순과 종유석을 따로 입력받음.
그리고 각각 H만큼 반복하면서 특정 높이에서 부딫히는 수를 누적합으로 계산
특정 높이에서 마주치는 석순과 종유석의 합을 구함. 이때 종유석은 위에서 자라나기 때문에 높이 변환을 해줌.
⏳ 회고
누적합이 약점인거 같아서 좀 풀어보려는데 너무 어려웠다.
힌트를 봤는데도 잘 모르겠어서 이해하는데 좀 걸렸다.