[20250226] BOJ / P2 / 점프 / 권혁준 #183
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/17613
🧭 풀이 시간
85분
👀 체감 난이도
✏️ 문제 설명
점프들을 수행한 후 목표 수 x에 도착하려 한다.점프 간격은 처음에 1이고, 다음부터는 직전점프 간격의 두 배로 증가해야 한다.점프 간격을 1로 초기화할 수 있다.점프횟수를🔍 풀이 방법
[사용한 알고리즘]
최대 점프를 한 번 해야한다. (목표 수를 넘지 않는 선에서 가능한 최대 간격까지 한 번 찍기)(증명이 너무 길어서 문제 풀며 쓴 메모장 첨부)
->
ans(x, y)라고 하고, 깊이 k에 존재하는 s번째 수부터 e번째 수까지 중에서의 정답을sol(k, s, e)라고 정의한다.ans(x, y)를 구할 때는, 깊이 별로 최댓값을 배열 D에서 참조하고 깊이의 부분 최댓값을 sol로부터 참조해서 구할 수 있다.sol(k, s, e)를 구할 때는,점프 횟수구하는 식에 의해 k + ans(s, e)로 구할 수 있다.⏳ 회고
return을 빼먹어서 틀렸다.