[20250512] BOJ / G1 / House Prices Going Up / 신희을 #332
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/25778
🧭 풀이 시간
30 분
👀 체감 난이도
✏️ 문제 설명
가상의 도시에는 집들이 1번부터 n번까지 번호가 매겨져 있고, 각 집의 초기 가격이 주어진다.
그 후에는 가격을 올리는 갱신 요청과, 특정 범위의 집 가격 총합을 구하는 조회 요청이 주어진다.
전체를 1초 안에 처리해야 하므로, 누적 합을 빠르게 처리할 수 있는 트리 기반 자료구조가 필요하다.
🔍 풀이 방법
세그먼트 트리
⏳ 회고
범위를 주의해서 long 형을 써주자