[20250925] BOJ / G5 / 숫자고르기 / 이준희 #971
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/2668
🧭 풀이 시간
75분 +
👀 체감 난이도
✏️ 문제 설명
세로로 2줄 N개의 칸으로 이루어진 표가 있고
윗줄은 1 ~ N까지 순서대로
아랫줄은 랜덤으로 이루어져 있습니다.
이 때 윗줄에서 뽑은 정수들의 집합이 바로 아래칸의 정수들의 집합과 같은 경우 중 가장 긴 집합을 구하고 그 원소들을 오름차순으로 출력하는 문제입니다.
🔍 풀이 방법
DFS를 활용하여 풀었습니다.
각 원소마다 DFS로 타고타고 들어가서 결국 다시 도착점에 도착하는 경우에 SET에 입력하여 유지했습니다.
⏳ 회고
접근 방법이 도저히 생각이 안났습니다.
매우 어려웠던 문제 같은데 골드 5네요..