[20250819] B형 / SWEA / 경유지운송 / 이강현 #695
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.
🧷 문제 링크
🧭 풀이 시간
90분
👀 체감 난이도
✏️ 문제 설명
도시와 도로가 있음.
도로에는 견딜 수 있는 최대 하중이 있음.
이동하면서 짐을 옮길거임.
특정 지점에서 시작해서 경유지를 거쳐 도착지로 이동할 때, 실을 수 있는 물건의 최대 하중을 구하기.
🔍 풀이 방법
다익스트라
다익스트라는 조건에 맞게 평범하게 구현하면 되고, 마지막으로 경유지를 거쳐서 도착할때
경유지 각각까지 가는데 가능한 최대 하중들과 도착지까지 가능한 최대 하중들을 모두 비교해서 그 중 최솟값을 출력하면 됨.
⏳ 회고
출발지에서 경유지를 거쳐서 도착지까지 가는데 여러가지 방법이 있으니까 이걸 모두 고려하려고 해서 머리가 아팠는데, 생각해보면 필요한 건 경유지를 모두 도달할 수 있고 도착지를 갈때 그 부분을 들렀을때 가질 수 있는 최대하중만을 단순 비교하면 되는 거였다.
또, 처음 생각할때 어떤 도시들을 들렀는지를 체크하는 상태를 가지고 있어야 생각해서 고민이 많았는데, 단순히 어떤 방식으로든 출발지에서 각각의 도시까지 최대 하중으로 연결하기만 하면 된다는 생각을 직관적으로 떠올리기 어려웠던 것 같다.