[20251110] BOJ / G4 / 좋은 수열 / 이준희 #1365
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/2661
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
1, 2, 3으로 이루어진 수열 중에 인접한 두개의 부분 수열이 있으면 나쁜 수열, 그렇지 않으면 좋은 수열이라고 합니다.
ex) 3'21''21'323 은 나쁜 수열, 32123 은 좋은 수열
이 때 N자리의 수열 중에 가장 작은 좋은 수열을 구하는 문제입니다.
🔍 풀이 방법
string을 이용하여 각 단계마다 1, 2, 3을 뒤에 추가하면서 좋은 수열인지 나쁜 수열인지 판단했습니다.
이를 이용해 이미 나쁜 수열인 경우에 다음 단계를 하지 않게 하여 시간을 줄였습니다.
⏳ 회고
뭔가 애매하게 복잡했던 것 같습니다. 말로 설명하기 힘든 그런 느낌