#P8248. 简单数列

简单数列

Description

You are given an integer nn. You need to construct an array aa of length nn (indices start from 11, and each element is one of 1,2,31,2,3 or 44), such that:

  • For the ii-th element, for all 1leni21 \le len \le \lfloor\frac{i}{2}\rfloor, the subarray ailen+1ia_{i-len+1\dots i} is not equal to ailen×2+1ilena_{i-len\times2+1\dots i-len}. (x\lfloor x \rfloor means rounding xx down.)

  • In plain words, there are no two adjacent consecutive substrings that are identical.

Input Format

One line with one positive integer nn.

Output Format

One line with nn positive integers, the array aa.

3
1 2 3
6
1 2 3 4 1 3

Hint

For 20%20\% of the testdata, 1n101 \le n \le 10.

For 40%40\% of the testdata, 1n301 \le n \le 30.

For 100%100\% of the testdata, 1n5001 \le n \le 500.

Translated by ChatGPT 5