[20251026] BOJ / G4 / 카드 섞기 / 김수연 #1232
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/1091
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
플레이어 3명에게 특정한 카드를 주려고 함
i번째 위치 -> S[i]번째 위치로 이동
P에는 각 카드가 어떤 플레이어에게 가야 하는지 저장
i번째 위치 -> 플레이어 P[i]로 보내야 함
카드 섞는 횟수의 최솟값 구하기
🔍 풀이 방법
단순 구현
처음에는 check을 2중 for문으로 현재 카드가 몇번째 인덱스에 저장되어 있는지 저장했었는데 시간 초과 나서 pos배열에 저장하고 찾았더니 안남
⏳ 회고
while문의 break 조건을 처음에 N*N으로 했었는데 그냥 처음이랑 같은지 여부를 확인해야 했음 쩝.