[20250720] BOJ / G4 / 소트 / 이종환 #509
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/1083
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
크기가 N인 배열 A가 있다. 배열에 있는 모든 수는 서로 다르다. 이 배열을 소트할 때, 연속된 두 개의 원소만 교환할 수 있다. 그리고, 교환은 많아봐야 S번 할 수 있다. 이때, 소트한 결과가 사전순으로 가장 뒷서는 것을 출력한다.
🔍 풀이 방법
N의 최댓값이 50인거에 힌트를 얻었다.
이 로직으로 진행하였다.
이때 위치 바꾸는 것은 시간복잡도가 여유로울 것이라 생각해서 전부 swap을 통해 진행하였다.
⏳ 회고
N의 최댓값을 크게하면 굉장히 어려운 문제가 될것같다