[20250910] BOJ / G3 / 택배 / 이준희 #858
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/1719
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
택배 집하장들과 두 집하장을 잇는 길, 그 길을 이동하는데 걸리는 시간이 주어졌을 때
집하장 사이를 최단시간으로 이동할 때 각 집하장에서 "처음으로 지나는 집하장 번호"를 출력하는 문제입니다.
🔍 풀이 방법
시간이 2초 제한인데 N이 200으로 크지 않았기 때문에 플로이드-워셜을 활용하여 풀었습니다.
시간 계산하는 배열과, 지나는 집하장 번호를 저장하는 배열 총 2개를 사용했습니다.
플로이드 -워셜의 내부에서 시간이 변경되는 경우 마다 지나는 집하장 번호도 갱신해 주며 풀었습니다.
⏳ 회고
문제의 요구사항이 집하장에서 집하장으로 이동하는 최단루트의 첫번째 집하장 번호를 출력하는 것이었는데, 제대로 읽지 않아서 처음에 플로이드-워셜로 시간만계산해서 계속 예제를 넣었는데 예제가 통과 안되서 경계값, 초기값 등 애먼 곳을 찾다가 시간을 허비했습니다.