[20251125] BOJ / G1 / 공평하게 팀 나누기 / 김민진 #1509
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.
🧷 문제 링크
공평하게 팀 나누기
🧭 풀이 시간
100분
👀 체감 난이도
✏️ 문제 설명
사람들을 두 그룹으로 나누는데 그룹 간 사람의 수 차이는 1 이하
그룹 간 몸무게 차가 가장 적을 때 각 그룹의 몸무게 합을 오름차순으로 출력하시오
🔍 풀이 방법
어차피 두 그룹으로 나누어야 하고 그룹 간 사람 수의 차이는 1 이하여야 해서
N/2까지만 확인함같은 맥락에서 굳이굳이
sum전부 확인할 필요 없을 것 같은데..⏳ 회고
dp
어
려
워
뭔가뭔가 어제 비트코인 문제랑 비슷해서 boolean dp겠거니 했는데 더 어려웠음
본인의 인덱스보다 작은 인덱스를 가져와서 갱신하면 역방향이어야 하고
본인의 인덱스보다 큰 인덱스를 가져와서 갱신하면 정방향