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/2056
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
수행해야 할 작업 N개가 있을 때, 선행 관계가 존재함.
서로 선행 관계가 없는 작업들은 동시에 수행이 가능할 때, 모든 작업을 완료하기 위한 최소 시간 구하기
🔍 풀이 방법
위상 정렬 사용
degree배열에 각 작업 별로 선행되어야 할 작업이 몇 개 있는지 저장해두고, 0인 애들을 큐에 넣어서 해당 작업이 완료되기까지 걸리는 가장 긴 시간을 result 배열에 저장해서 구함
result 배열을 while문 안에서 바로바로 갱신했는데, 그러면 degree가 처음부터 0인 애들을 고려 못해서 다 끝나고 확인해줘야 함
⏳ 회고
위상 정렬 오랜만에 푸니까 헷갈렸다..