Skip to content

Conversation

@oncsr
Copy link
Contributor

@oncsr oncsr commented Aug 8, 2025

🧷 문제 링크

https://www.acmicpc.net/problem/14577

🧭 풀이 시간

20분

👀 체감 난이도

✏️ 문제 설명

N개의 지역에 각각 눈이 a[i]만큼 쌓여있다.
여기에 네 가지 종류의 작업을 총 M번 수행해보자.

  1. i번 지역에 눈이 x만큼 쌓인다.
  2. i번 지역에 눈이 x만큼 녹는다.
  3. 적설량이 L이상 R이하인 구역의 수를 센다.
  4. 적설량이 T번째로 많은 도시의 적설량을 구한다.

🔍 풀이 방법

  • pb_ds

pb_ds에 적설량을 모두 넣어놓는다.

1, 2번 작업은 단순히 pb_ds에 erase, insert하는 것으로 구현했다.
3번 작업은 order_of_key 함수로 (r+1미만인 지역 수) - (l미만인 지역 수)를 구해 해결했다.
4번 작업은 적설량을 매개 변수로 두고 이분 탐색을 진행해서 구했다. 이 때도 order_of_key를 사용했다.

⏳ 회고

java는 pb_ds를 지원 안해서 어쩔 수 없이 c++로 짬

@oncsr oncsr added the success 👍 해설을 보지 않고 풀었을 때 label Aug 8, 2025
@ShinHeeEul ShinHeeEul merged commit cd2066f into main Aug 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

success 👍 해설을 보지 않고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants