[20250902] BOJ / G5 / 전깃줄 / 이준희 #799
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/2565
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
전봇대 A B 사이를 잇는 전깃줄이 있을 때
전깃줄이 서로 교차되지 않게 하기 위해 제거해야 하는 전깃줄의 최소 개수를 구하는 문제입니다
🔍 풀이 방법
LIS를 구하는 문제로 풀이하였습니다.
전깃줄 배열을 A, B 둘 중 하나로 정렬을 한 후
정렬한 반대편 전봇대의 번호를 이용하여 LIS를 구했습니다.
이 때 전체 전깃줄 갯수에서 LIS를 빼게 되면 교차되는 전깃줄 갯수이므로 이렇게 구현하였습니다.
⏳ 회고
2차원 배열 정렬 방법을 안다면 쉽게 풀 수 있는 문제 같습니다.