[cpp] 백준 13907. 세금 (Platinum IV) (민코딩 다익스트라의 탑 2번. 통행) #57
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.
🌁 Background
민코딩 다익스트라 과제
👩💻 Contents
[Platinum IV] 세금 - 13907
📱 Screenshot
📝 Review Note
민코딩에서
다익스트라
를 중첩해서 작동시키는 방법으로 1차적으로 해결한 뒤, 백준에서 타임아웃을 마주쳤다.이를 해결하기 위해
DP
를 적용했고, 타임아웃은 해결했으나, 1초 이상의 시간이 소요되는 불편한 상황이 발생했다.속도를 올릴 방법을 생각하던 중, 어쳐피
DP
를 적용하기 때문에우선순위 큐
를 사용할 필요가 없다는 결론과, 결과에그리디 알고리즘
을 추가로 적용해 영원히 최소 경로가 될 수 없는 경우의 수를 제거해주며 최적화를 한 결과 소요 시간을250ms
까지 줄일 수 있었다.