#C11171. Generate Nice Array

    ID: 40458 Type: Default 1000ms 256MiB

Generate Nice Array

Generate Nice Array

You are given an integer n. Your task is to generate a "nice" array of length n that satisfies the following property:

For every consecutive triplet of elements a[i], a[i+1], a[i+2] (for all valid i), their sum must be even. It can be proven that a repeating pattern of [1, 1, 2] always gives a valid solution for n ≥ 3.

If n is less than 3, it is impossible to form such an array, and you should output -1.

Example:

  • Input: 3 → Output: 1 1 2
  • Input: 5 → Output: 1 1 2 1 1
  • Input: 6 → Output: 1 1 2 1 1 2
  • Input: 1 → Output: -1

inputFormat

A single integer n, representing the length of the array.

outputFormat

If n < 3, output -1. Otherwise, output the 'nice' array as space-separated integers in one line.## sample

3
1 1 2