Submit solution

Points:
5

Time limit:
2.0s

Memory limit:
256M

Author:

Problem type

Allowed languages

Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, ~~CommonLisp~~, D, Dart, F#, Forth, Fortran, Go, ~~Groovy~~, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, ~~Nim~~, ~~ObjC~~, OCaml, ~~Octave~~, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Salarios77 deals with large amounts of numbers on a daily basis. To ensure consistency in his storage of special numbers, he likes following a particular format when possible:

- for all even (ascending order).
- for all odd (descending order).

Given some records of numbers, determine if it is possible to follow the pattern, and if possible output the pattern.

#### Input Specification

First line contains , the amount of numbers provided.
The second line consists of spaced integers, which represent ^{th} value.

#### Output Specification

If it is impossible, output: `IMPOSSIBLE`

.
If it is possible, output the integers in order separated by a space.

#### Sample Input 1

```
4
1 1 1 1
```

#### Sample Output 1

`1 1 1 1`

#### Sample Input 2

```
4
1 3 3 4
```

#### Sample Output 2

`1 4 3 3`

## Comments

The problem is a bit confusing but essentially we only look at the output integers'formatting but not the input ones

You might want to consider stating the restrictions for n.

Shouldn't it say

If the input is

Is the "2" the first term or the zero-th term?

Zero-th term. The output would be

`2 8 4 6`

. The even terms would be`2`

and`4`

, while the odd terms would be`8`

and`6`

.Shouldn't sample output 2 be "1 3 3 4" as this minimizes the difference?

In fact you don't need to worry about the differences, just take note at the statement:

Sorry, the problem statement was not clear. The minimized difference must be for every other term, so like: _3_4, ignore the 1 and 3. Same goes for 1_3_. In other words the minimized difference between consecutive odd/even indexed terms only.