[20250805] BOJ / G5 / ABCDE / 이준희 #610
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/13023
🧭 풀이 시간
25분
👀 체감 난이도
✏️ 문제 설명
친구관계가 주어질 때 A->B->C->D->E 처럼 5명이 연속으로 친구가 되는 경우에 1 앞선 경우가 없으면 0을 출력하는 문제입니다.
🔍 풀이 방법
dfs를 이용하여 풀었습니다.
5명이 연속해서 친구가 되면 플래그를 true로 하여 이를 판단하여 출력하였습니다.
⏳ 회고
n이 2000이었기 때문에 최대 2억번 연산이고 시간제한이 2초라서 인접행렬로 풀었는데 시간초과가 발생해서 인접리스트로 바꿨습니다.
문제 조건을 잘 파악하여 사용해야겠습니다.