[20250828] BOJ / P4 / 시간은 다시 움직인다 / 권혁준 #761
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/27316
🧭 풀이 시간
45분
👀 체감 난이도
✏️ 문제 설명
고비가 N번 찾아온다.
i번째로 능력을 사용하면 i초동안의 고비를 모두 넘길 수 있고, 이후로는 i초가 지나야 다시 능력을 사용할 수 있다.
모든 고비를 넘길 수 있는지 알아보자.
🔍 풀이 방법
고비가 찾아오는 시간의 범위가 200000이니까, 능력은 많아야 sqrt(200000)번 쓸 수 있다.
그래서 200000 * sqrt(200000) 크기로 DP 테이블 잡고 돌려주면 된다.
dp[n][t] = t번째 능력이 끝난 시점이 n초일 때, n초까지 찾아온 모든 고비를 넘길 수 있는지어떤 범위에 고비가 존재하는지 빠르게 알기 위해 누적 합을 사용함.
⏳ 회고
so ez