Couple Breaker Minwook (Small)
Time limit1sMemory limit1024 MB
Split a row of N people into the fewest contiguous groups, then reorder the groups so that no couple stands next to each other.
Problem
In the Small version, output only 1 of the possible arrangements.
Minwook, the Couple Breaker, is single, so he dislikes seeing couples together. He finds a waiting line of people standing in a row. He will split this line into groups and then reorder the groups so that no two members of a couple stand next to each other. However, he cannot reverse the order of people within a group or rearrange them. The groups may have different sizes.
If is large, reordering the groups becomes a headache for Minwook, so he wants to be as small as possible. For the minimum , he wants to find just one of the possible arrangements.
Input
The first line contains an integer (), the number of people.
The second line contains integers (), separated by spaces. describes the person standing at position from the front. If , that person is single. If and , persons and are a couple. Every nonzero value appears exactly twice in .
Output
On the first line, print the minimum value of .
On the second line, print the number of people in group 1, group 2, ..., group , separated by spaces.
On the third line, print the group numbers from the front of the line after the groups are reordered.
If every way of splitting the line into groups and arranging them leaves at least one couple adjacent, print on the first line and nothing after it.