[20250213] BOJ / G5 / 색칠하기 / 설진영 #107
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/13265
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
연결된 정점끼리는 서로 다른 두 색을 가져야 하고, 색은 두개 사용한다
🔍 풀이 방법
BFS로 번갈아 가며 색을 칠하는데, 만약 색이 칠해져 있다면 색을 비교해서 이전 색과 같으면 불가능 출력
각 노드에 대해 방문하지 않았다면 BFS를 돌리고, 처음 색은 중요하지 않음
⏳ 회고
로직은 금방 생각해내서 적용했는데, 코드에 너무 실수가 많다. 기본 코드를 잘 숙지해서 실수하지 않도록 하장