[20250711] BOJ / G4 / 토너먼트 만들기 / 김수연 #437
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/2262
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
n명의 사람들이 토너먼트 대회를 치를 때, 부전승을 임의로 만들며
각 시합에 임하는 두 선수의 랭킹의 차이의 합이 최소가 되는 값 구하기
🔍 풀이 방법
처음에는 dfs로 모든 경우의 수를 계산했는데, 메모리 초과가 떠서
그리디 알고리즘으로 가장 랭킹이 낮은 선수를 골라서 해당 선수부터 랭킹 차이가 작도록 배치
⏳ 회고
문제를 풀 때 더 효율적인 방법이 없는지를 계속 고민해야겠다.