#P9508. 『STA - R3』存在

『STA - R3』存在

Problem Description

Construct a sequence of length nn such that every subarray of length at least 22 has a majority element. Based on this, maximize the number of distinct values in the sequence. The majority element of a sequence is defined as a number whose occurrence count is at least half of the sequence length.

Each element in your constructed sequence must be an integer between 00 and 10910^9.

Input Format

One line containing a positive integer nn.

Output Format

One line containing nn integers, representing the sequence you constructed. If there are multiple answers, output any one of them.

3
1 1 2

Hint

This problem uses bundled tests.

Constraints:

  • Subtask 1 (10pts): n5n \le 5.
  • Subtask 2 (40pts): nn is a multiple of 33.
  • Subtask 3 (50pts): No special restrictions.

For all data, 1n1031 \le n \le 10^3.

Translated by ChatGPT 5