[20250706] BOJ / P4 / 가톨릭대학교에 워터 슬라이드를?? / 권혁준 #412
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/18133
🧭 풀이 시간
10분
👀 체감 난이도
✏️ 문제 설명
건물이 N개 있고, 일방통행인 터널이 M개 있다.
어떤 건물에 물을 부으면, 터널을 타고 도달 가능한 모든 건물에 물이 찬다.
모든 건물에 물을 보내기 위해서 물을 부어야 하는 건물의 최소 개수를 구해보자.
🔍 풀이 방법
주어진 그래프를 강한 연결 요소로 묶어서 다시 그리면 방향 비순환 그래프(DAG)가 만들어진다.
새 그래프에서 진입 차수가 0인 점이 곧 다른 점으로부터 물을 받을 수 없는 점이고, 이 수가 정답이 된다.
⏳ 회고
🤔