[20250204] BOJ / 플레4 / 수열과 쿼리 21 / 신희을 #32
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/16975
🧭 풀이 시간
90 분
👀 체감 난이도
✏️ 문제 설명
길이가 N인 수열 A1, A2, ..., AN이 주어진다. 이때, 다음 쿼리를 수행하는 프로그램을 작성하시오.
1 i j k: Ai, Ai+1, ..., Aj에 k를 더한다.
2 x: Ax 를 출력한다.
🔍 풀이 방법
느리게 갱신되는 세그먼트 트리 기본 구현 문제
일반 세그먼트 트리와 갱신 세그먼트 트리를 두고, 나중에 조회할 때 업데이트 되도록 구현하자.
⏳ 회고
오랜만에 풀려고 하니 시간이 오래걸리고 에러가 많이 발생했다. 코테에 나와도 구현할 수 있을 정도로 숙달시켜놓자.