[20260216] BOJ / G3 / 피리 부는 사나이 / 한종욱#1939
Merged
ShinHeeEul merged 1 commit intomainfrom Feb 16, 2026
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/16724
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
문제 스토리는 긴데, 재해석하면 격자에 화살표를 주고 독립적인 사이클이 몇개냐?를 물어본다.
🔍 풀이 방법
각 좌표들을 분리집합으로 연결하면 루트 노드가 몇 개인지를 세면 된다.
⏳ 회고
내 코드에서 그냥 union을 했을 때, 좌표압축이 안된다는 사실을 알았다. find 함수에서 좌표압축을 해서 그대로 될 줄 알았는데 정작 union때는 좌표압축이 아니라 마지막에 셀 때 한번 더 해줘야 했다.