Merged
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/24240
🧭 풀이 시간
5분
👀 체감 난이도
✏️ 문제 설명
N개의 지역들과 M개의 간선으로 이루어진 그래프가 주어진다.
지역들 중 W개의 장소에는 식수 창고가, F개의 장소에는 식량 창고가 있다.
0번 지역에서 출발하여 식수 창고와 식량 창고를 모두 들러 다시 0번 지역으로 돌아오는 최단 거리를 구해보자.
🔍 풀이 방법
0번째 비트를 식수 창고 방문 여부, 1번째 비트를 식량 창고 방문 여부로 둔다.
dist 배열을 2차원으로 정의해서 지역 번호 + 방문 여부를 하나의 상태로 보는 다익스트라를 수행했다.
⏳ 회고
예전에 봤을 땐 어케 풀지 싶었는데 지금 다시 보니 걍 기본적인 2차원 다익스트라였다.