Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/2467
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
N개의 용액이 주어지며, 각 용액은 산성(양수) 또는 알칼리성(음수)
두 용액을 섞어 특성값의 합이 0에 가장 가까운 조합을 찾기
입력은 오름차순으로 정렬되어 주어짐
같은 용액을 두 번 사용할 수는 없음
🔍 풀이 방법
왼쪽 포인터는 맨 처음 (가장 작은 값), 오른쪽 포인터는 맨 끝 (가장 큰 값)에서 시작
두 값을 더해서 0에 가까운지 확인
절댓값 기준 가장 작은 합이 나올 때마다 결과 갱신
⏳ 회고
정수 범위 큰거 확인, -> 이분탐색이나 투포인터
입력이 정렬되어 있다는 점을 보고 투 포인터로 접근할 수 있었음