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/2254
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
2차원 좌표평면 세상에 점 (Px, Py)에 감옥이 있고 담 기둥이 N개 있다.
이 기둥들을 이어서 다각형 모양의 담을 만들 수 있다.
담은 여러 개 만들 수 있지만, 각각의 담은 감옥을 완전히 감싸야 하고, 담 안에 또 다른 담이 있다면 이를 완전히 포함해야 한다.
겹치지 않게 만들 수 있는 최대 담의 겹 수를 구해보자.
🔍 풀이 방법
[사용한 알고리즘]
의식의 흐름대로, 볼록 껍질을 밖에서부터 만들 수 있을 만큼 만든 게 답이라 생각했다.
과정은 다음과 같다.
이렇게 해서 만들었던 볼록 껍질의 개수가 답이 된다.
⏳ 회고
감옥이 볼록 껍질 내에 포함되는지 확인할 때 CCW를 사용했는데, 방향 판정을 반대로 해놓고 뭐가 틀렸나 한참을 고민했다.