[20250717] BOJ / G1 / 배열 정렬 / 이강현 #487
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/28707
🧭 풀이 시간
90분
👀 체감 난이도
✏️ 문제 설명
크기가 N인 배열을 정렬해라.
근데 M개의 특정한 두 개의 인덱스끼리만 바꿀 수 있다.
바꾸는데 비용이 든다.
정렬하는데 드는 최소 비용을 출력해라.
🔍 풀이 방법
다익스트라, 해시를 이용한 맵
⏳ 회고
다익스트라인데, int 배열로 했던 distance 기록을 맵으로 기록하는 것으로 바꾼거임.
근데 애초에 다익스트라라고 생각하는 것도 좀 힘들고 int[]로 상태 저장해둔다는 게 좀 까다로웠음. 대혁준