[20250618] BOJ / P5 / 상남자 곽철용 / 권혁준 #370
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/17947
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
4N개의 카드로 M명의 참가자가 게임을 한다.
각 참가자는 2개의 카드를 버리고, 총 2N개의 남은 카드들로 게임을 진행한다.
각 참가자는 2개의 카드를 뽑고, 두 장의 카드에 적힌 숫자를 K로 나눈 나머지의 차이를 점수로 얻는다.
철용이가 뽑은 두 장의 카드가 주어지면, 철용이를 이기는 사람들이 최대 몇 명인지 구해보자.
🔍 풀이 방법
[사용한 알고리즘]
철용이의 점수를 미리 구해놓고, 사용되지 않은 카드 리스트를 만든다.
이 리스트에서 두 카드를 골랐을 때 서로 멀리 있을수록 얻는 점수가 커진다.
이 리스트를 반갈해서 양쪽에서 한 장씩 고르는 것이 항상 이득이 된다.
반 갈랐을 때 같은 쪽에서 두 개를 골라도 철용이의 점수를 넘을 수는 있지만, 항상 위의 경우로 옮겨줄 수 있기 때문이다.
⏳ 회고
아이디어가 참신함