analysis
A probability question
For each grid, may be coated with a color c, so
1 is the initial color, the initialization:
Selected interval for each grid, half of the probability of selection coated, not painted half of the probability
If not painted, so that the original color, so this is a probability that the original color
Half of the original probability of this color
If to be painted, then the probability of a color painted particular 1 / c
So, coloring the core program:
To do so of course timeout
Optimization can be a little bit (though not much use):
There is no simple way to do that, or we did that exercise in futility?
Ah, as if each grid is independent,
Also, the probability of the number of colors and coloring of only about (not found, then you can step through and see)
That can we focus on it?
Direct process 1 ~ k times the probability of the coloring, is obtained directly set like the frequency of each bin Coloring
good idea
The number of coloring each grid, violence, or the difference
Probability corresponding processing times:
Ah, well