#Q203. 「一本通 6.2 练习 4」Sherlock and His Girlfriend
「一本通 6.2 练习 4」Sherlock and His Girlfriend
Description
Original problem from: Codeforces Round #400 B.
Sherlock has a new girlfriend (which is very unlike him!). Valentine's Day is approaching, and he wants to give her some jewelry as a gift.
He bought pieces of jewelry. The value of the -th piece is . That is, the values of the jewelry are .
Watson challenges Sherlock to color these pieces such that when the value of one piece is a prime factor of another, the two pieces must have different colors. Additionally, Watson requires him to minimize the number of colors used.
Please help Sherlock complete this simple task.
Input Format
A single integer , representing the number of jewelry pieces.
Output Format
The first line should contain an integer , indicating the minimum number of colors used.
The second line should contain integers, representing the colors assigned to the -st to the -th piece of jewelry. If there are multiple possible solutions, output any one of them.
Sample 1
3
2
1 1 2
Sample 2
Since is a prime factor of , the first and third pieces of jewelry must have different colors.
4
2
2 1 1 2
Data Range and Hints
For all data, .