[20251022] BOJ / G4 / 댄스 파티 / 김수연 #1194
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/2831
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
남자 N명 여자 N명이 파티에 있을 때,
각 사람은 자신보다 키 큰 이성 (양수), 자신보다 키 작은 이성 (음수)과 춤추고 싶어하는 선호하는 유형을 가지고 있음
이 때, 최대 몇 쌍의 커플을 만들 수 있는지 구하기
🔍 풀이 방법
투 포인터 이용
각 유형의 사람별로 ArrayList 따로 생성하고 오름차순 정렬함
그리고, 자신보다 큰 사람을 원하는 사람한테 이성 중에 그 사람보다는 크지만 가장 키가 작은 사람 매칭 시켜줌
⏳ 회고
에휴 난 알고바보야 에휴에휴에흉헤ㅠㅇㅎ에ㅠ흉헤ㅠㅇ헤ㅠ에ㅠㅎ