[20250727] BOJ / G4 / 타임머신 / 이준희 #554
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/11657
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
도시들이 있고 각 도시들을 이동하는 버스 정보가 주어질 때
1번 도시에서 나머지 도시들로 이동할 때 드는 코스트를 출력하는 문제입니다.
🔍 풀이 방법
각 도시를 이동하는데 드는 코스트가 양수가 아닌 경우가 있었습니다. (코스트가 0으로 순간이동, 음수로 타임머신으로 시간을 되돌림)
음수 가중치가 있을 때 최단거리를 구하는 벨만포드 알고리즘을 사용했습니다.
⏳ 회고
벨만포드를 써야한다는 것만 생각나고 구현이 생각나지 않아서 공부하고 풀었습니다.
이 때문에 시간도 생각보다 많이 걸렸습니다.
아직 재활훈련이 더 필요할 것 같습니다....