[20250312] BOJ / G3 / 일감호에 다리 놓기 / 신희을 #232
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/17490
🧭 풀이 시간
110 분
👀 체감 난이도
✏️ 문제 설명
강의동 사이사이가 공사중이다. 일감호 중간에 있는 섬을 통해서 공사중인 구간을 피해서 모든 강의동이 이어지도록 하려고 한다. 이때 강의동에서 섬까지 돌을 놓는다 할 때, K개의 돌을 이용해서 모든 강의동을 이을 수 있는가?
🔍 풀이 방법
그리디로 가장 작은 돌이 드는 강의동부터 연결한 뒤, 해당 강의동으로부터 도달 가능한 강의동을 전부 visited 처리해주었다.
⏳ 회고
우리 학교 문제여서 한번에 풀고 싶었는데, 생각보다 숨은 조건들이 있어서 한번에 못 푼 게 아쉽다 ㅠ 그리고 Union-Find를 이용하면 더 성능 좋게 구현할 수 있는 것 같다.