So, I’m doing this problem, but I can’t seem to understand the sample case.
If I’m correct, this problem is noting that if all the cows that admire cow C should share the same color. However, in that case the sample case doesn’t seem to be optimal. The only conditions we have to satisfy are 2=6, 5=4, and 7=3, where those numbers are the cow numbers. In that case, can’t we definitely assign more than 3 colors?
Cow 1 only admires cow 7 (if you didn’t notice, the test data was kind of reversed- they said that it was in the form of a\text{ }b, where cow b admires cow a). I don’t see how cow 1 and cow 4 share the same cow.