Mock CCC '20 Contest 2 S1 - Arithmetic Hybercube

View as PDF

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 128M

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

Arithmetic Square, everyone's favourite problem. Welcome to the better problem, Arithmetic Line!

You are given integers, which are guaranteed to form an arithmetic sequence. However, they appear scrambled! Can you recreate the arithmetic sequence given the integers?

Recall that an arithmetic sequence of length is a sequence of integers of the form

for integer values of and . For the purposes of this problem, is a non-negative integer.

Input Specification

The first line will contain the integer , the number of integers.

The second line will contain integers, , the integers you are given. It is guaranteed that these integers form an arithmetic sequence in some permutation of them.

Output Specification

Output the recreated arithmetic sequence.

Sample Input

3
7 3 5

Sample Output

3 5 7

Explanation For Sample

The arithmetic sequence of integers that is built has and .