COCI00106
Cuskija
스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
레이팅
의견: 0
설명
Rearrange the given array of integers so that the sum of two adjacent elements is never divisible by
three.
제약
입력 형식
The first line contains an integer \(N\) (\(1 \le N \le 10000\)), the number of elements in the array.
The second line contains the elements of the array separated by single spaces. The elements will be positive integers less than \(1000000\).
출력 형식
If any valid rearrangement exists, output it on a single line. Otherwise, output "impossible".
서브태스크
| 서브태스크 | 점수 | 설명 |
|---|---|---|
Subtask 1 | 100점 |
예제 1
입력
3
1 2 3출력
2 3 1예제 2
입력
5
4 6 3 9 8출력
3 4 6 8 9예제 3
입력
6
3 7 6 4 2 8출력
3 7 4 6 2 8예제 4
입력
3
3 12 9출력
impossible문제 정보
태그
평가 및 의견
Cuskija
개별 의견
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Cuskija
게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다.
로그인하고 제출하기