# Random Generator: Official Solution

*English translation by SOTA – AI Community of the Russian original. Organisers who would like this translation removed can email sota.ai.community@gmail.com.*

All-Russian School Olympiad in Informatics 2025–2026, Final Stage<br>
“Artificial Intelligence” profile, Tour 1, Moscow, 23 March 2026<br>
Task B

*The official solutions file repeats each statement before its solution; the statement is in the task statement file. The marking criteria below come from the “Marking criteria for the first tour” pages at the end of the same file.*

## Solution

**Answer:** $m = 10$.

The probability that the number $k \in \{1, 2, 3, 4, 5\}$ appears at a given position of the sequence is

$$\mathbb{P}(k) = \frac{1}{m}.$$

Since all the other numbers are replaced by 6, the same probability for the number 6 is

$$\mathbb{P}(6) = \frac{m - 5}{m}.$$

In the sequence under study, the value 6 occurs 5 times, and the numbers $1, \ldots, 5$ occur another 5 times. Therefore, the probability of obtaining this sequence equals

$$\left(\frac{1}{m}\right)^5 \left(\frac{m - 5}{m}\right)^5 = \left(\frac{m - 5}{m^2}\right)^5.$$

The maximum value of this probability is attained when the quantity

$$\frac{m - 5}{m^2} = \frac{1}{m} - \frac{5}{m^2}$$

takes its largest possible value.

Let $x = \frac{1}{m}$. Since the maximum of the quadratic function $f(x) = x - 5x^2$ is attained at $x = \frac{1}{10}$, the required value is $m = 10$.

## Marking criteria

A. $\mathbb{P}(6) = (m - 5)/m$ is found: 5 points.

B. The probability of the sequence from the statement is found for a fixed $m$: 15 points.

C. It is stated that the probability from the previous criterion increases for integer $m$ from 6 to 10 and decreases after that: 15 points.

D. The probability is computed with an error of a constant factor (or other inaccuracies that do not affect the course of the solution): at least 5 points are deducted.

M. It is proved that the number 10 is an extremum. It is used, but not proved, that it is precisely a maximum: at least 5 points are deducted.

- All the listed progress items and penalties are added up.
