Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/29200
🧭 풀이 시간
25분
👀 체감 난이도
✏️ 문제 설명
N개의 문제가 있고, 각 문제의 레벨은 A[i]
문제들을 한 개 이상의 연속된 구간으로 분할
-> 각 구간을 하나의 새로운 문제로 대체. 새 레벨은 기존 문제들 레벨을 XOR한 값
(인접한 두 구간의 문제 수가 달라야 함)
새 문제들의 레벨 합을 최대로 해보자.
🔍 풀이 방법
두 수를 XOR한 값은 반드시 두 수의 합 이하가 된다.
-> 구간의 길이가 길면 손해임.
그래서 구간 길이를 최대 4로 두고 2차원 DP(N*4)를 돌려줬다.
⏳ 회고
구간 길이를 최대 2로 둬도 될 줄 알고 냈는데 틀리길래 하나씩 늘려보다가 4로 하니까 맞았다.
왜 맞는지 고민해봐야할듯