## CPC '19 Contest 1 P1 - Distance

View as PDF

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 64M

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

Eric wants to visit all of his friends. Each friend lives at house , labelled from to . Each house is separated by a single kilometre, meaning that the distance between house and house would be . He decides to be a "cool kid", and not travel a certain distance more than once.

For example, if there are 3 houses, he could start at the third house, proceed to the first house, and visit the second house last, with travel distances of .

Eric must visit all of the houses. Can you output a sequence that Eric can follow, such that he visits all houses and never travels the same distance twice?

#### Input Specification

The first and only line of input will contain an integer , the number of houses Eric needs to visit. The houses are labelled from to .

#### Output Specification

You are to output a sequence of houses that matches the constraints stated in the problem description, each house separated by a space.

#### Sample Input 1

3

#### Sample Output 1

1 3 2

#### Sample Explanation 1

For the first sample, he could also travel from house to , and then to as stated in the problem description.

#### Sample Input 2

2

#### Sample Output 2

2 1

#### Sample Explanation 2

In the second sample, he could also travel from to .