[20250830] BOJ / P4 / 부모님께 큰절 하고 / 권혁준 #777
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/18859
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
길이 N인 수열을 재배열해서 감소등차수열 + 증가등차수열로 만들 수 있는지 알아보자.
🔍 풀이 방법
수열의 최솟값을 기준으로 두 개의 등차수열을 만들 수 있어야 한다.
그중 하나는 수열을 정렬해서 첫 두 값을 기준으로 만들 수 있다.
나머지 수열은 첫 등차수열에서 사용되지 않은 수들로 만들 수 있는데, 이 때 첫 등차수열의 마지막 값이 여기에 포함될 수도 있다.
이렇게 성공적으로 두 수열이 뽑혔으면 Yes, 아니면 No이다.
⏳ 회고
그리디너무싫다진짜개어렵다
아니어렵진않은데자꾸틀렸다니까걍화만잔뜩남