[20251016] BOJ / G3 / 백양로 브레이크 / 이준희 #1136
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/11562
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
모 대학교에서 길을 공사하게 되면서 양방향이었던 길이 일부 일방통행으로 변하여
특정 건물에서 다른 건물로 이동할 수 없는 경우가 발생했습니다.
건물과 건물을 잇는 길의 양방향 통행 가능 여부가 주어졋을 때
주어지는 각 요청에 대하여 건물과 건물을 이동하는데 양방향으로 복원이 필요한 길의 최소갯수를 구하는 문제입니다.
🔍 풀이 방법
이미 양방향인 길의 경우 가중치를 0, 단방향이어서 양방향으로 바꾸어야 이동이 가능한 길의 가중치를 1로 설정하여 플로이드-워셜을 돌려서 풀었습니다.
⏳ 회고
가중치를 0과 1로 만들어서 풀어야된다는 것만 알면 굉장히 쉬운 문제였던 것 같습니다.