[20250829] BOJ / G1 / 공평하게 팀 나누기 / 이준희 #766
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/4384
🧭 풀이 시간
70분
👀 체감 난이도
✏️ 문제 설명
학생의 수와 각 학생의 몸무게가 주어졌을 때
두 팀의 인원수 차이가 1 이하이면서, 두 팀간의 몸무게합의 차이가 최소화되도록 하는 경우의 두 팀의 무게를 작은 순으로 출력하는 문제입니다.
🔍 풀이 방법
boolean dp를 이용하여 풀었습니다.
해당 인원수로 만들 수 있는 무게를 체크한 후
팀 인원수는 무조건 n/2이기 때문에
dp[n/2][weight] 인 weight를 모두 체크하여 몸무게 차이를 계산했습니다.
⏳ 회고
처음에 dp문제라는 것은 알고 접근하려고 했는데 어떤 식으로 접근해야할 지 감이 안잡혀서 힌트를 얻어서 풀었습니다.
dp는 담아가면서 합을 계산하는 것만 풀어봐서 이런 유형은 처음이었는데 숙지해놔야 할 것 같습니다.