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/20306
🧭 풀이 시간
180분
👀 체감 난이도
✏️ 문제 설명
점 N개로 이루어진 볼록다각형 모양의 블랙홀 내부에 특이점 (x, y)가 존재한다.
블랙홀을 이루는 N개의 점은 시간 t일 때 특이점으로부터 (t+1)배 멀어진다.
블랙홀은 블랙홀의 내부와 경계에 있는 건물들을 집어삼킨다.
M개의 건물이 주어지면, K개 이상의 건물을 집어삼키게 되는 최소 시간을 구해보자.
🔍 풀이 방법
특이점이 (0,0)에 위치하도록 모든 점들을 평행이동했다.
건물을 반시계 방향으로 정렬하면, 특이점과 건물을 잇는 반직선이 블랙홀과 만나는 구간을 O(N)만에 모두 돌 수 있다.
이제 각 건물마다 이 건물이 집어삼켜지는 시간 t를 이분 탐색으로 찾는다.
-> t초에 집어삼켜진다면, t 이후의 시간대에선 항상 집어삼켜진 상태이기 때문
구한 시간을 정렬해서 그 중 K번째에 오는 시간을 구해줬다.
⏳ 회고
CCW를 구할 때 정수 오버플로우가 발생해서 자바의
BigInteger를 사용했는데 시간 초과가 남. + 이분 탐색 범위를 잘못 잡음C++의
__int128을 이용해서 다시 짜서 냈는데 좌표가 10^36을 넘을 수도 있어서 여전히 오버플로우가 남.파이썬으로 짜니까 맞았다....