[20250206] BOJ / 골드2 / 로고 / 권혁준 #51
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/3108
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
좌표평면의 (0,0) 위치에 거북이 한 마리가 y축 증가 방향을 바라보며, 연필을 내리고 있다.
사용자는 다음과 같은 다섯가지 명령으로 거북이를 조종할 수 있다.
FD x: 거북이를 x만큼 앞으로 전진
LT a: 거북이를 반시계 방향으로 a도 만큼 회전
RT a: 거북이를 시계 방향으로 a도 만큼 회전
PU: 연필을 올린다
PD: 연필을 내린다.
축에 평행한 직사각형$N$ 개가 주어지면, 필요한 PU 명령의 최소 횟수를 구해야 한다.
🔍 풀이 방법
직사각형 두 개가 서로 만난다면, 두 개를 그리는데 PU 명령 한 번으로 가능하다.
분리 집합으로 직사각형을 합치면서 한 번에 그릴 수 있는 집합을 관리하자.
⏳ 회고
가로 세로를 반대로 해놓고 뭐가 틀린지 모르고 있었다