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/3020
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
석순과 종유석이 번갈아서 나타나는 동굴을 일직선으로 석순과 종유석을 부수면서 날아가는 개똥벌레가 있습니다.
이 때 가장 적게 석순, 종유석을 부수는 경우에 몇개를 부수는지 또 그러한 경로가 몇개인지 구하는 문제입니다.
🔍 풀이 방법
h(동굴 높이)가 50만으로 매우 커서 누적합을 이용했습니다.
석순과 종유석 배열을 따로 두고 각각의 누적합을 구한 후 최종 단계에서 각 높이별로 부딪히는 장애물의 갯수를 파악했습니다.
⏳ 회고
처음에 입력받을 때 석순, 종유석의 방향에 상관없이 다 밑에서 위로 향하는 것처럼 입력 받아놓고 누적합 계산할 때는 종유석이라고 인덱스를 거꾸로 시작해서 뻘짓했습니다.