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/10165
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
원형의 버스 노선이 있는데, 비용 절감을 위해 일부 버스 노선을 취소하려고 한다. 취소되는 노선은 다른 노선에 포함되어 있는 노선이다. 계속 운행될 버스 노선을 오름차순으로 출력하라.
🔍 풀이 방법
버스 노선과 index를 배열에 저장하고
으로 정렬한다. 이렇게 정렬하는 이유는 포함되는 버스 노선을 생략하기 위함이다.
원형을 계산하기 위해
끝점을 기준으로 포함되면 삭제하고, 아니면 끝점을 갱신한다.
⏳ 회고
이 문제를 맨 처음 Event로 들어가고 나가고를 분리했다. 근데 너무 복잡해지며 풀기 어려웠다.
Event로 나누는 경우와 구간 전체를 쓰는 경우를 잘 판단해야 한다.