Problem O
Star Wars röðun
Languages
en
is
We define starwars-order, as an operation on a list of numbers, such that if the list is ordered, the first third moves to the center, the center third moves to the front and the last third stays put.
The problem is as follows, given a list of numbers, give their starwars-order.
For example for the Star wars movies, the starwars-order of $1, 2, 3, 4, 5, 6, 7, 8, 9$ would be $4, 5, 6, 1, 2, 3, 7, 8, 9$.
Input
The first line contains a single integer $n$, the number of numbers where $n$ is a multiple of $3$. The second line contains $n$ different integers separated by spaces, where each value $x$ satisfies $1 \leq x \leq 10^9$.
Output
The starwars-order of the values in the input, given on a single line, separated by spaces.
Scoring
Group |
Points |
Constraints |
1 |
20 |
$n = 9$ |
2 |
80 |
$3 \leq n \leq 3*10^5$ |
Sample Input 1 | Sample Output 1 |
---|---|
9 1 2 3 4 5 6 7 8 9 |
4 5 6 1 2 3 7 8 9 |
Sample Input 2 | Sample Output 2 |
---|---|
3 5 9 10 |
9 5 10 |
Sample Input 3 | Sample Output 3 |
---|---|
6 6 55 1 3 8 34 |
6 8 1 3 34 55 |