[20250824] BOJ / G4 / 이분 그래프 / 이준희 #728
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/1707
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
그래프의 점을 2 부분집합으로 나누었을 때
한 집합끼리는 서로 인접하는 경우가 없으면 이분 그래프라고 할 때
주어지는 그래프가 이분그래프가 될 수 있는지 판단하는 문제입니다.
🔍 풀이 방법
bfs로 탐색하며 flag를 두어 1 또는 -1 집합에 들어가는 것으로 간주
bfs를 진행할 때 인접하는 점이 같은 집합에 들어가면 이분 그래프가 안되므로
이를 판단해서 풀었습니다.
⏳ 회고
색칠하는 것처럼 표시하는 방법을 떠올리고 나서는 금방 구현해서 풀었습니다