He was standing before a garden, all a-bloom with roses.
"Good morning," said the roses.
The little prince gazed at them. They all looked like his flower.
"Who are you?" he demanded, thunderstruck.
"We are roses," the roses said.
And he was overcome with sadness. His flower had told him that she was the only one of her kind in all the universe. And here were five thousand of them, all alike, in one single garden!
"She would be very much annoyed," he said to himself, "if she should see that... she would cough most dreadfully, and she would pretend that she was dying, to avoid being laughed at. And I should be obliged to pretend that I was nursing her back to life-- for if I did not do that, to humble myself also, she would really allow herself to die..."
Then he went on with his reflections: "I thought that I was rich, with a flower that was unique in all the world; and all I had was a common rose. A common rose, and three volcanoes that come up to my knees-- and one of them perhaps extinct forever... that doesn't make me a very great prince..."
And he lay down in the grass and cried.
Assume the garden of roses has n rows of roses, where there are n roses in each row, aligned in a square. Initially, each rose has a color(color of the petals, of course!). The rose in the i-th row and j-th column is colored with cij.(There are surely colorful roses! Why would people only think of red ones when it comes to roses?)
When little prince wanders in the garden of roses, he will burst into tears when he sees two roses with the same color in the same row or the same column, as that would remind him his flower is not unique in this world.
You, a kind person, definitely don't want to see the little prince cry. Fortunately, you arrived at the garden of roses just before the little prince. You have a magic painter that could paint the stems of some roses into different colors(You don't want to ruin the petals of the roses, do you?). Initially, the stems of all roses are green. You want to paint the stems of some roses into different colors, such that no two roses in the same row or column would no longer have both the same color of petals and stems. The only problem is the number of pigments with distinct colors you need to prepare. As preparing pigments with distinct colors is time-consuming, you want to use as little pigments as possible. Please find a way to paint the flowers such that the condition is satisfied. As long as the number of pigments is minimized, any valid way of painting flowers would be considered correct.
"Good morning," said the roses.
The little prince gazed at them. They all looked like his flower.
"Who are you?" he demanded, thunderstruck.
"We are roses," the roses said.
And he was overcome with sadness. His flower had told him that she was the only one of her kind in all the universe. And here were five thousand of them, all alike, in one single garden!
"She would be very much annoyed," he said to himself, "if she should see that... she would cough most dreadfully, and she would pretend that she was dying, to avoid being laughed at. And I should be obliged to pretend that I was nursing her back to life-- for if I did not do that, to humble myself also, she would really allow herself to die..."
Then he went on with his reflections: "I thought that I was rich, with a flower that was unique in all the world; and all I had was a common rose. A common rose, and three volcanoes that come up to my knees-- and one of them perhaps extinct forever... that doesn't make me a very great prince..."
And he lay down in the grass and cried.
Assume the garden of roses has n rows of roses, where there are n roses in each row, aligned in a square. Initially, each rose has a color(color of the petals, of course!). The rose in the i-th row and j-th column is colored with cij.(There are surely colorful roses! Why would people only think of red ones when it comes to roses?)
When little prince wanders in the garden of roses, he will burst into tears when he sees two roses with the same color in the same row or the same column, as that would remind him his flower is not unique in this world.
You, a kind person, definitely don't want to see the little prince cry. Fortunately, you arrived at the garden of roses just before the little prince. You have a magic painter that could paint the stems of some roses into different colors(You don't want to ruin the petals of the roses, do you?). Initially, the stems of all roses are green. You want to paint the stems of some roses into different colors, such that no two roses in the same row or column would no longer have both the same color of petals and stems. The only problem is the number of pigments with distinct colors you need to prepare. As preparing pigments with distinct colors is time-consuming, you want to use as little pigments as possible. Please find a way to paint the flowers such that the condition is satisfied. As long as the number of pigments is minimized, any valid way of painting flowers would be considered correct.