DMOPC '22 Contest 5 P2 - Absolutely Even

View as PDF

Submit solution


Points: 7 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem types

Bob loves absolutely even arrays. For an array A, let X be the number of subarrays with a non-negative sum, and Y be the number of subarrays with a negative sum. An absolutely even array of size N is one which has the minimum absolute difference |XY| over all possible arrays of size N. Please give Bob an example of an absolutely even array.

Constraints

1N2×105

Subtask 1 [30%]

1N8

Subtask 2 [70%]

No additional constraints.

Input Specification

The first and only line contains the integer N.

Output Specification

The first and only line of your output should contain N space-separated integers A1,A2,,AN, an array A which minimizes the value of |XY|.

|Ai|1012 must hold.

Sample Input

Copy
3

Sample Output

Copy
1 -3 2

Explanation for Sample

X and Y are both equal to 3. The 3 subarrays with a non-negative sum are [1], [1,3,2], and [2]. The 3 subarrays with a negative sum are [1,3], [3], and [3,2]. The value of |XY| is 0, which is minimal.


Comments

There are no comments at the moment.