[20250718] BOJ / G5 / 행복 유치원 / 김수연 #494
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/13164
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
N명을 K개의 조로 나누려고 함
최소 1명, 같은 조 원생은 서로 인접해 있어야 함
조별 티셔츠 비용은 (가장 키 큰 원생 - 가장 키 작은 원생)
🔍 풀이 방법
처음엔 K-1개의 인덱스를 지정해서 계산을 하려고 했는데,
그냥 인접한 원생들의 키의 차이를 저장해두고 작은거 부터 N-K개 더하면 됨
⏳ 회고
간단하게 풀 수 있는걸 너무 꼬아서 풀려고 했다....