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/14577
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
N개의 지역에 각각 눈이 a[i]만큼 쌓여있다.
여기에 네 가지 종류의 작업을 총 M번 수행해보자.
🔍 풀이 방법
pb_ds에 적설량을 모두 넣어놓는다.
1, 2번 작업은 단순히 pb_ds에 erase, insert하는 것으로 구현했다.
3번 작업은 order_of_key 함수로
(r+1미만인 지역 수) - (l미만인 지역 수)를 구해 해결했다.4번 작업은 적설량을 매개 변수로 두고 이분 탐색을 진행해서 구했다. 이 때도 order_of_key를 사용했다.
⏳ 회고
java는 pb_ds를 지원 안해서 어쩔 수 없이 c++로 짬