Skip to content

Conversation

@Ukj0ng
Copy link
Contributor

@Ukj0ng Ukj0ng commented Nov 22, 2025

🧷 문제 링크

https://www.acmicpc.net/problem/2470

🧭 풀이 시간

40분

👀 체감 난이도

✏️ 문제 설명

두 용액을 고르는데, 두 용액의 합이 0과 제일 가까운 경우를 출력하라

🔍 풀이 방법

인덱스 하나씩 고정해놓고 반대편꺼 찾을 때, 이분 탐색

⏳ 회고

아직도 언제는 left<=right고 언제는 left<right인지 모르겠네

어떤 걸 써야 할까?
left <= right를 쓰는 경우:

배열에서 정확한 값을 찾을 때
범위를 [0, len(arr)-1]로 초기화할 때
mid 값을 확인 후 완전히 제외하고 싶을 때

left < right를 쓰는 경우:

lower_bound/upper_bound (이상/초과 값) 찾을 때
범위를 [0, len(arr))로 초기화할 때
최종 답이 left 또는 right 자체일 때

라네

@ShinHeeEul ShinHeeEul merged commit 83d46a4 into main Nov 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants