[20260205] BOJ / G4 / 사냥꾼 / 김민진 #1890
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.
🧷 문제 링크
사냥꾼
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
N개의 타겟이 있고M개의 사대(총 쏘는 곳)이 있음사정거리가
L일 때 사냥 가능한 타겟은?거리는 맨해탄 거리로 계산
🔍 풀이 방법
이분탐색
a.
y좌표가 사정거리보다 멀면 passb. 이분 탐색 진행하며
x축 기준으로 사대 두 개 고르기c.
x - 사대 위치가 작은 것 기준으로 사정거리 계산⏳ 회고
lowerbound는 나를 포함한 수 중 가장 작은 것
upperbound는 나를 제외한 수 중 가장 작은 것
이 문제에서는 둘 중 하나만 쓰고 결과
±1하면 됨헷갈린다~~