[20251129] BOJ / G5 / 선 긋기 / 이준희 #1543
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/2170
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
일직선 위에 여러개의 선을 그을 때 겹치는 선은 구별할 수 없습니다.
여러개 선의 각각의 시작지점, 끝지점이 주어졌을 때
그려지는 선의 총 길이를 구하는 문제입니다.
🔍 풀이 방법
선을 시작지점 순으로 해서 정렬한 다음
순회하면서 겹치는 부분을 계속 갱신하여 하나의 선으로 만들어주었습니다.
겹치는 부분이 없는 경우에는 그 전까지의 선 길이를 계산하고 다음 새 선으로 넘어갔습니다.
⏳ 회고
크게 어렵지 않은 문제였습니다.