[20251229] BOJ / G3 / 고기잡이 / 한종욱 #1750
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/7573
🧭 풀이 시간
80분
👀 체감 난이도
✏️ 문제 설명
물고기와 그물이 주어진다. 그물로 물고기를 제일 많이 잡을 수 있는 물고기 수는?
🔍 풀이 방법
그물의 변에 물고기가 걸쳤을 때, 최적의 해이다.
물고기마다 탐색해서, '해당 물고기가 그물의 윗변에 걸려있다', '해당 물고기가 그물의 왼쪽 변에 걸려있다'로 경우를 나눠 최대 값을 구한다.
⏳ 회고
먼저 꼭짓점에 물고기가 있는 경우가 최적의 해라고 생각해서 한번 틀렸고, 다른 사람과의 풀이를 비교해보니 나보다 빨리 푼 사람들은 좌표 압축과 후보군만 비교하는 방식을 사용했다. 나는 전부 슬라이딩 윈도우 방식을 적용했는데 이를 개선해서 풀어봐야겠다.