[20250722] BOJ / G5 / 두 개의 탑 / 이강현 #524
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/2118
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
1부터 N개의 지점에 두개의 탑을 놓을 거임.
이 둘 사이의 거리가 가장 멀어지게 끔 세운다고 할때, 그 거리를 출력
🔍 풀이 방법
투 포인터
투 포인터로 같은 방향을 향해 가되, 매 순간 시계방향 합과 반시계방향 합을 비교해서 그 중 작은 것을 이용해서 최댓값을 업데이트함.
⏳ 회고
투 포인터로 반대방향으로 가는 것만 생각하다보니 오래 걸렸고, 시작점에 따라 나올 수 있는게 달라질 수 있기에 풀이 방법을 떠올리기 어려웠다. 같은 방향으로 가면서 매 순간 업데이트 하는 방식이 새로웠고 시작점이 달라서 풀이가 어렵다면 이러한 방법을 생각해보면 좋을 것 같다.