[20251017] BOJ / G5 / 용앱 합성하기 / 이준희 #1146
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/14921
🧭 풀이 시간
10분
👀 체감 난이도
✏️ 문제 설명
-1억 ~ 1억의 특성값을 갖는 용액들이 있을 때
두 용액을 합성했을 때 특성값의 합이 0에 가장 가까운 경우의 특성값을 구하는 문제입니다.
🔍 풀이 방법
투포인터를 활용하여 풀었습니다.
문제 조건에서 입력자체가 정렬되어 있기 때문에 왼쪽끝 오른쪽끝에서 시작하여 합이 양수, 음수를 분기로 하여 처리했습니다.
0에 가깝다는 것은 절대값을 활용하여 판단했습니다.
⏳ 회고
처음에 음수일 때도 양수(절대값)으로 출력해서 틀렸는데 예제를 잘 봐야겠습니다.