Mjehuric
의견: 0
Goran has five wooden pieces arranged in a sequence. There is a number between \(1\) and \(5\) inscribed on every piece, so that every number appears on exactly one of the five pieces.
Goran wants to order the pieces to form the sequence \(1, 2, 3, 4, 5\) and does it like this:
- If the number on the first piece is greater than the number on the second piece, swap them.
- If the number on the second piece is greater than the number on the third piece, swap them.
- If the number on the third piece is greater than the number on the fourth piece, swap them.
- If the number on the fourth piece is greater than the number on the fifth piece, swap them.
- If the pieces don't form the sequence \(1, 2, 3, 4, 5\), go to step 1.
Write a program that, given the initial ordering of the pieces, outputs the ordering after each swap.
The first line contains five integers separated by single spaces, the ordering of the pieces. The numbers will be between \(1\) and \(5\) (inclusive) and there will be no duplicates. The initial ordering will not be \(1, 2, 3, 4, 5\).
After any two pieces are swapped, output the ordering of the pieces, on a single line separated by
spaces.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
Subtask 1 | 40점 |
2 1 5 3 41 2 5 3 4
1 2 3 5 4
1 2 3 4 52 3 4 5 12 3 4 1 5
2 3 1 4 5
2 1 3 4 5
1 2 3 4 5평가 및 의견
Mjehuric
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Mjehuric