#P10950. 太鼓达人
太鼓达人
Problem Description
The drum in Taiko no Tatsujin is broken, and now vani is here to fix it.
The main component of the drum is sensors arranged in a circle.
Each sensor has two working states, on and off, denoted by and , respectively.
Obviously, starting from different positions and checking consecutive sensors clockwise, you can obtain binary strings of length .
Vani knows that these binary strings should be pairwise distinct.
Also, the drum is very precisely designed, so takes the maximum possible value.
Now Vani already knows the value of . He wants you to find the value of and give the lexicographically smallest sensor arrangement.
Input Format
An integer .
Output Format
An integer and a binary string, separated by a space, representing the maximum possible and the lexicographically smallest arrangement.
Character means off, and means on. In the string you output, the first character and the last character are adjacent.
3
8 00010111
Hint
Constraints: .
Translated by ChatGPT 5