Skip to content

Conversation

@lkhyun
Copy link
Contributor

@lkhyun lkhyun commented Jul 5, 2025

🧷 문제 링크

https://www.acmicpc.net/problem/16724

🧭 풀이 시간

40분

👀 체감 난이도

✏️ 문제 설명

성우가 피리를 불면 N X M 필드에 정의된 명령에 따라 회원들이 움직여야 함.
근데 재훈이가 지친 회원들을 위해서 명령에 따르지 않아도 되는 save zone을 만들려고 함.
이때, 필드의 어디 부분에 있든 save zone으로 갈 수 있게 하려고 하는데 그때 save zone의 최소 개수를 출력.

🔍 풀이 방법

분리 집합, DFS
분리 집합으로 풀었는데 2차원이므로 i,j를 가지는 pos라는 객체를 만들어서 equals와 hashcode를 재정의했음.
이후 모든 필드에서 명령에 따라 만나게 되는 인접 필드와 merge를 하는 방식을 진행하고
hashset을 이용해서 pos의 개수를 셈

⏳ 회고

흠냐

@lkhyun lkhyun self-assigned this Jul 5, 2025
@lkhyun lkhyun added the success 👍 해설을 보지 않고 풀었을 때 label Jul 5, 2025
@ShinHeeEul ShinHeeEul merged commit 9140db2 into main Jul 5, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

success 👍 해설을 보지 않고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants