Editorial for An Animal Contest 6 P5 - Rock Painting
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1 Hint
What is the probability of rock
Subtask 1
Let's create an array
We also define
where
Therefore, the final answer to this problem is:
Time Complexity:
Subtask 2
For this subtask, we can generalize the definition of
Using some algebra, we have:
Substituting the sum of geometric series formula into the equation, we get:
Time Complexity:
Subtask 3
This subtask is an extension of subtasks 1 and 2 and is left as an exercise for the reader.
Time Complexity:
Comments