[20251030] BOJ / P5 / Pineapple Pizza / 권혁준 #1274
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/15878
🧭 풀이 시간
50분
👀 체감 난이도
✏️ 문제 설명
좌표평면에 N개의 파인애플 조각이 좌표로 주어진다.
점 Q를 기준으로 반직선을 K개 그어서 나눠진 각 구역의 파인애플 조각 개수를 똑같이 만들 수 있는지 알아보자.
🔍 풀이 방법
Q가 원점이 되도록 점들 대칭이동시키기
점들을
각정렬하고 원점 기준으로스위핑하면서 파인애플 개수 기록이 배열을 원형이라고 가정하고 구간을 k개로 쪼개서 각각의 합이 동일하도록 만들 수 있으면 YES, 아니면 NO
⏳ 회고
단순히 ccw < 0으로 정렬하면 안되고, y축으로 잘라서 두 구역으로 나눠야 했음.
그리고, size함수가 unsigned 정수라서 size - 1을 했더니 INT_MAX값이 되어버리는 사고가 있었다.