Beautiful Sequence
InterviewTime limit1sMemory limit256 MB
Given N, print a sequence of N ones and N minus ones that maximizes the final value B_N of the recurrence B_i = B_(i-1) * A_(2i-1) + A_(2i).
- Level
Medium5 of 10
- Topics
- Greedy, Math, Implementation
- Solved
- No attempts yet
Problem
For a sequence of length , its beauty is defined as follows.
Print the sequence with the maximum beauty among the sequences that satisfy the conditions below.
- The length of the sequence is .
- Exactly of its elements are 1, and the other elements are -1.
Input
The first line contains .
Output
Print the sequence with the maximum beauty, with each term separated by a space.