[20251020] BOJ / G2 / 컬러볼 / 김수연 #1173
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/10800
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
공들의 색과 크기가 주어질 때, 각 플레이어는 자기 공보다 크기가 작고 색이 다른 공을 사로잡아 그 공의 크기만큼 점수를 얻을 수 있다.
이 때, 각 플레이어가 사로잡을 수 있는 모든 공들의 크기의 합 구하기
🔍 풀이 방법
누적합 이용
공의 크기가 작은 순서대로 정렬하고,
해당 공의 idx보다 작은 공에 대해서 각 색깔 별로 얻을 수 있는 점수 저장해두고, 이를 총합에서 빼서 정답 구함
⏳ 회고
에휴 누적합은 늘지를 않냐