# Analysis of the School-Stage Tasks of the All-Russian School Olympiad 2025/26 in Artificial Intelligence (Region Group I), Grades 9–11

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

*Translator's note: the original is a single PDF in which each task's statement is followed by its answer, scoring criterion and solution. Tasks 7 and 8 are programming tasks: the file gives only their scoring criteria and solutions, not their statements. The data file for Task 6 and the answer options for Task 3 are not part of the file. Spreadsheet formulas are given with English function names (see Task 6).*

**Maximum score for the olympiad — 112**

## Task 1

In the Unsafe Vault there are four safes numbered 1, 2, 3, 4. The safes are not labelled, but the staff know which is which. The safes are fitted with electronic combination locks; a code consists of 4 digits, each of which is either 0 or 1. In the correct code, the position whose number equals the safe's number holds a one, and all the other positions hold zeros. For example, the code for safe number 3 is 0010. After the safes are closed, the electronic locks are connected to a server, which swaps the four existing codes around so that all 24 possible permutations are equally likely.

What is the probability that at least one safe gets its correct code again?

**Answer:** $\frac{5}{8}$

**Scoring criterion:** exact match of the answer — 12 points

**Maximum score for the task — 12**

**Solution.**

There are $4! = 24$ permutations of the four labels in total.

Let us count in how many permutations at least one code stays in its place. To do this, we use the inclusion–exclusion principle.

**1. First, we count all permutations in which at least one code is in its place.** We can choose which code stays — 4 ways. The remaining 3 codes can be permuted in any way — $3! = 6$ ways. In total, $4 \times 6 = 24$ permutations.

**2. But this counts too much.** If two codes are in place at once, such a permutation has been counted twice — once when the first code was chosen and once when the second was chosen. To correct this, we subtract the number of permutations in which *exactly two* codes are in place: we choose these two codes — 6 ways, and the remaining two can be permuted in $2! = 2$ ways. We subtract $6 \times 2 = 12$.

**3. But now we have subtracted too much.** If three codes are in place at once, we subtracted such permutations three times, whereas only two subtractions were needed, so we must add them back: we choose these three codes (4 ways), and the last code is left on its own — $1!$ way. We add $4 \times 1 = 4$.

**4. Finally, when all four are in place,** we added such a permutation four times, then subtracted it six times and added it four times again — so in total it has been counted three times. To correct this, we subtract one repetition: $1 \times 0! = 1$.

Now we add everything up, taking the signs into account:

$$24 - 12 + 4 - 1 = 15.$$

That is, there are 15 permutations in which at least one code has stayed in place.

There are 24 permutations in total, so the probability is

$$P = \frac{15}{24} = \frac{5}{8}.$$

## Task 2

At the qualifying stage of an online olympiad, each participant is given three problems, each of which is either in mathematics or in artificial intelligence. Suppose that in the new season the problem type at position $i$ coincides with last year's with probability $s_i$ and switches to the opposite with probability $1 - s_i$. The choice is made independently for different positions. It is known that $s_1 = 2/3, s_2 = 1/3, s_3 = 3/4$. Petya has analysed last year's problem sets and is sure that, even before the round starts, he can predict the problem types at all three positions at once: either none of them will change and they will be the same as last year, or all of them will switch to the opposite (that is, artificial intelligence will come up instead of mathematics, and vice versa).

Petya wants the average number of correctly guessed positions (the mathematical expectation) to be as large as possible. Which prediction is optimal in this case?

1. The problem types will not change
2. The problem types will switch to the opposite

Find the average number of positions (the mathematical expectation) guessed correctly by Petya if he follows the optimal strategy.

**Answer:** The problem types will not change; 7/4

**Scoring criterion:** 6 points for each correct answer. Total — 12 points

**Maximum score for the task — 12**

**Solution.**

Denote by $X_i$ the indicator of a correct guess at position $i$ (equal to 1 if Petya guessed correctly, and 0 otherwise). Then the average number of correct guesses is

$$E[X_1 + X_2 + X_3] = EX_1 + EX_2 + EX_3.$$

Two strategies:

- “As last year” (we predict that the types will not change): $EX_i = s_i$. Then $E = s_1 + s_2 + s_3 = \frac{2}{3} + \frac{1}{3} + \frac{3}{4} = \frac{7}{4}$.
- “The opposite” (we predict that all the types will switch): $EX_i = 1 - s_i$. Then $E = (1 - s_1) + (1 - s_2) + (1 - s_3) = \frac{1}{3} + \frac{2}{3} + \frac{1}{4} = \frac{5}{4}$.

Since $\frac{7}{4} > \frac{5}{4}$, it is optimal to predict “The problem types will not change”, and the maximum expectation equals $\boxed{\frac{7}{4}}$.

## Task 3

There are 18 points with integer coordinates on the plane. Each point has a class number: 0, 1, 2 or 3.

Class 0: red.<br>
Class 1: blue.<br>
Class 2: green.<br>
Class 3: yellow.

Determine for which $k$ the $k$ nearest neighbours method correctly guesses the class of the three chosen points. The method works as follows: for a new point, we find the $k$ points from the list that are nearest to it. If several points are at the same distance, the one with the smaller class number is considered nearer. We count which class number occurs most often among these $k$ points; that number is the one chosen. If the frequencies are equal, the following rules are applied:

1. Among these classes, we choose the one whose sum of distances to the new point is smaller.
2. If there is a tie again, we take the class with the smaller number.

Let us single out three points: $(8; 2)$ of class 0, $(3; 4)$ of class 1 and $(5; 0)$ of class 2. To make the check fair, these three points are removed from the list in advance, and then the class of each of them is determined from the remaining 15 points.

*[Figure: see the [original statement](https://siriusolymp.ru/2025/ai).]*

*Translator's transcription of the figure (a scatter plot with $x$ from 0 to 10 and $y$ from −2 to 5; the three singled-out points are drawn in a paler shade):*

| Class | Marker in the figure | Points |
|---|---|---|
| 0 | red circle | $(8, 3)$, $(9, 2)$; singled out: $(8, 2)$ |
| 1 | blue square | $(2, 3)$, $(4, 3)$, $(5, 3)$; singled out: $(3, 4)$ |
| 2 | green triangle | $(6, 0)$, $(7, 0)$, $(7, -1)$, $(8, -1)$; singled out: $(5, 0)$ |
| 3 | orange diamond | $(1, 2)$, $(4, 2)$, $(2, 1)$, $(4, 1)$, $(6, 1)$, $(2, 0)$ |

Choose the number of neighbours for which the method correctly determines the class of all three singled-out points simultaneously:

*[The answer options are not listed in the original file.]*

**Answer:** 1, 2, 5

**Scoring criterion:**
(Number of correct choices − Number of incorrect choices) × 4, minimum 0 points

**Maximum score for the task — 12**

**Solution.**

Before classification, each of the three singled-out points is excluded from the training set.

*Point $(8, 2)$, true class 0.* Nearest neighbours:

$$(8, 3)\ (0),\ (9, 2)\ (0) \text{ at } 1; \quad (7, 0)\ (2),\ (6, 1)\ (3) \text{ at } \sqrt{5}; \ \ldots$$

For $k = 1, 2$ the answer is 0. For $k = 3$ the third neighbour is taken with the smaller class number among the points at the equal distance $\sqrt{5}$, that is, class 2; the count is 0:2 versus 2:1 — class 0 wins. For $k = 4, 5$ class 0 keeps the majority.

*Point $(3, 4)$, true class 1.* Nearest:

$$(4, 3)\ (1),\ (2, 3)\ (1) \text{ at } \sqrt{2}; \quad (5, 3)\ (1),\ (4, 2)\ (3) \text{ at } \sqrt{5}; \ \ldots$$

For $k = 1, 2$ the answer is 1. For $k = 3$ the third point taken is $(5, 3)$ of class 1 (it has the smaller class number at the equal distance $\sqrt{5}$), so the answer is 1. For $k = 4$ the count is 1:3 versus 3:1 — again 1.

*Point $(5, 0)$, true class 2.* Order of distances:

$$(6, 0)\ (2) \text{ at } 1; \quad (6, 1)\ (3),\ (4, 1)\ (3) \text{ at } \sqrt{2}; \quad (7, 0)\ (2) \text{ at } 2; \quad (7, -1)\ (2),\ (4, 2)\ (3) \text{ at } \sqrt{5}; \ \ldots$$

- $k = 1$: class 2 — correct.
- $k = 2$: a tie between classes 2 and 3; we compare the sums of distances: class 2: 1, class 3: $\sqrt{2}$; we take 2 — correct.
- $k = 3$: two neighbours of class 3 and one of class 2 — an error.
- $k = 4$: a 2:2 tie; sums of distances: for class 2: $1 + 2 = 3$; for class 3: $\sqrt{2} + \sqrt{2} \approx 2.828$; class 3 is chosen — an error.
- $k = 5$: $(7, -1)$ of class 2 is added; the count is 3:2 in favour of class 2 — correct.
- $k \ge 6$: the point $(8, 2)$ has at least three green neighbours $(6, 0), (7, 0), (8, -1)$, which means it will certainly not be classified as red.

Thus, all three points are classified correctly at the same time exactly for $\boxed{k = 1,\ 2,\ 5}$.

## Task 4

Four simple rules are given in the form of “question trees”, which, depending on various features, assign an object the label 0 or 1. An object is described by three features:<br>
$A$ — a binary feature: 0 or 1;<br>
$B$ — shape: circle, square or triangle;<br>
$C$ — a number (may be any real number)

Tree 1:

*[Figure: see the [original statement](https://siriusolymp.ru/2025/ai).]*

- $B$ = circle?
  - no → $A = 0$?
    - no → Label 0
    - yes → Label 1
  - yes → $C \ge 3$?
    - no → Label 1
    - yes → Label 0

Tree 2:

*[Figure: see the [original statement](https://siriusolymp.ru/2025/ai).]*

- $B$ = square?
  - no → $C \ge 4$?
    - no → Label 0
    - yes → Label 1
  - yes → $A = 0$?
    - no → Label 0
    - yes → Label 1

Tree 3:

*[Figure: see the [original statement](https://siriusolymp.ru/2025/ai).]*

- $A = 1$?
  - no → $C = 3$?
    - no → Label 0
    - yes → Label 1
  - yes → $B$ = triangle?
    - no → Label 1
    - yes → Label 0

Tree 4:

*[Figure: see the [original statement](https://siriusolymp.ru/2025/ai).]*

- $C \ge 2$?
  - no → $A = 1$?
    - no → Label 0
    - yes → Label 1
  - yes → $B$ = square?
    - no → Label 0
    - yes → Label 1

*(The trees above are the translator's transcription of the four tree diagrams.)*

Find the unique object (values of $A$, $B$, $C$) that receives label 1 from all four trees.

**Answer:** $A = 0$, $B$ = square, $C = 3$

**Scoring criterion:** 4 points for each correct answer. Total — 12 points

**Maximum score for the task — 12**

**Solution.**

Let us write all the trees using logical operations.

$$
\begin{aligned}
T_1 &: \ (B = \text{circle} \ \wedge\ C < 3) \ \vee\ (B \ne \text{circle} \ \wedge\ A = 0),\\
T_2 &: \ (B = \text{square} \ \wedge\ A = 0) \ \vee\ (B \ne \text{square} \ \wedge\ C \ge 4),\\
T_3 &: \ (A = 1 \ \wedge\ B \ne \text{triangle}) \ \vee\ (A = 0 \ \wedge\ C = 3),\\
T_4 &: \ (C \ge 2 \ \wedge\ B = \text{square}) \ \vee\ (C < 2 \ \wedge\ A = 1).
\end{aligned}
$$

**Step 1 (crossing $T_2$ with $T_4$).** If the right-hand alternative fired in $T_2$ ($B \ne \text{square} \wedge C \ge 4$), then in $T_4$, with $C \ge 4$, the left-hand one ($C \ge 2 \ \wedge\ B = \text{square}$) must fire — a contradiction. Hence only the left-hand alternative remains in $T_2$:

$$\boxed{B = \text{square}, \quad A = 0}.$$

Then in $T_4$, with $B = \text{square}$, the branch $C < 2$ is impossible (it requires $A = 1$); therefore

$$\boxed{C \ge 2}.$$

**Step 2 (fixing $C$ via $T_3$).** With $A = 0$, tree $T_3$ outputs 1 if and only if $C = 3$. Hence

$$\boxed{C = 3}.$$

**Step 3 (checking $T_1$ and $T_4$).** In $T_1$: $B = \text{square} \ne \text{circle}$ and $A = 0$ — the right-hand branch gives 1.<br>
In $T_4$: $C = 3 \ge 2$ and $B = \text{square}$ — the left-hand branch gives 1.

**Result and uniqueness.** The unique solution is:

$$\boxed{A = 0, \quad B = \text{square}, \quad C = 3}.$$

Uniqueness is guaranteed because (i) the pair $T_2 + T_4$ rigidly fixes $B = \text{square}, A = 0$; (ii) $T_3$ then rigidly fixes $C = 3$; (iii) after that, $T_1$ and $T_4$ are satisfied automatically.

## Task 5

A mail filter marks emails as “spam” (the positive class) or “not spam” (the negative class). A total of $N = 1000$ emails were checked; $P$ is the total number of spam emails in the sample. Let:<br>
$TP$ — spam emails that the filter correctly marked as spam (True Positives),<br>
$FP$ — ordinary emails mistakenly marked as spam (False Positives),<br>
$FN$ — spam emails mistakenly marked as not spam (False Negatives),<br>
$TN$ — ordinary emails correctly marked as not spam (True Negatives).

Metrics:<br>
Precision — the proportion of spam correctly marked as spam.

$$\text{Precision} = \frac{TP}{TP + FP}$$

Accuracy — the proportion of correct answers among all emails.

$$\text{Accuracy} = \frac{TP + TN}{N}$$

It is known that Accuracy $= 0.8$ and Precision $= 0.5$. Find the possible values of $P$. Find the range of $TP$.

**Answer:** $P = 200$, $TP \in [1, 200]$

**Scoring criterion:** each of the three numbers is worth 4 points; maximum 12 points.

**Maximum score for the task — 12**

**Solution.**

From Accuracy $= 0.8$ with $N = 1000$ we obtain

$$TP + TN = 0.8 \cdot 1000 = 800 \ \Rightarrow\ FP + FN = 200.$$

Since $\text{Precision} = 0.5 = \dfrac{TP}{TP + FP}$, we have $TP = FP$ (and $TP + FP > 0$, hence $TP \ge 1$).

Then

$$FN = 200 - FP = 200 - TP, \qquad P = TP + FN = TP + (200 - TP) = 200,$$

that is, $P$ is fixed and equals 200.

Constraints on $TP$: $FN = 200 - TP \ge 0 \Rightarrow TP \le 200$; also $TP \ge 1$ from the condition $TP + FP > 0$. Therefore,

$$TP \in [1, 200].$$

## Task 6

Botanists are planning a field experiment. In a preliminary study, they selected several plots and on each of them counted the trees of two species:

$$x_1 \text{ — the number of maples}, \qquad x_2 \text{ — the number of lime trees}.$$

In addition, the botanists recorded their opinion on whether each plot is suitable for the experiment:

$$y = \begin{cases} 1, & \text{if the plot is suitable;} \\ 0, & \text{if it is not suitable.} \end{cases}$$

The director of the nature reserve assessed the plots by his own criterion:

$$s = 0.4 \cdot x_1 + 0.6 \cdot x_2.$$

He computed the *median* of all the values of $s$ (let us denote it Median) and allowed the experiment to be carried out only on the plots that simultaneously satisfy the conditions:

$$y = 1 \quad \text{and} \quad s \ge \text{Median}.$$

**Problem.** How many plots satisfy these conditions?

**Explanation.** The median Median is a value that divides an ordered set of numbers into two parts of equal size. If the number of elements is even, the median is taken to be the arithmetic mean of the two central values.

**Data.** The table is in a separate file (in XLSX, ODS or CSV format), where each row contains the values $x_1$, $x_2$ and $y$ for one plot.

**Answer:** 43

**Scoring criterion:** exact match of the answer — 12 points

**Maximum score for the task — 12**

**Solution.**

*Translator's note: the original writes the formulas below for a Russian-language spreadsheet (Russian function names, decimal commas and semicolons between arguments); here they are given with the English function names MEDIAN, IF and COUNTIFS.*

**Step 1. The director's individual score.** In cell D2 enter:

`=0.4*A2+0.6*B2`

and drag the formula down to D101.

**Step 2. The median of column $D$.** In cell F2 (any free column “off to the side”) enter:

`=MEDIAN(D2:D101)`

**Step 3. The “not below the median” indicator.** In cell E2 enter (note the fixed row `F$2`):

`=IF(D2>=F$2, 1, 0)`

and drag the formula down to E101.

**Step 4. Counting the suitable plots (the botanists are “in favour” and $s \ge$ median).** The final formula can be placed, for example, in H2:

`=COUNTIFS(C2:C101, 1, E2:E101, 1)`

This formula counts the rows in which simultaneously $y = 1$ (column $C$) and the indicator from column $E$ equals 1, that is, $s \ge \text{Median}$.

## Task 7

*[The statement of this programming task is not included in the original file.]*

**Scoring criterion:** 1 point for each test not taken from the statement. Total — 20 points

**Maximum score for the task — 20**

**Solution.**

We discard at most $K$ values so that the spread $\max - \min$ of the remaining ones is minimal. Let $M = N - K$ numbers remain. After sorting, it suffices to go through all segments of length $M$: for the window $[a_i, \ldots, a_{i+M-1}]$ the minimum radius equals $\left\lceil \dfrac{a_{i+M-1} - a_i}{2} \right\rceil$ (the centre is the midpoint of this segment). The answer is the minimum over all windows.

```python
N, K = map(int, input().split())
a = []
while len(a) < N:
    a += list(map(int, input().split()))
a.sort()
M = N - K
ans = 10**30
for i in range(N - M + 1):
    d = a[i + M - 1] - a[i]
    r = (d + 1) // 2
    if r < ans:
        ans = r
print(ans)
```

## Task 8

*[The statement of this programming task is not included in the original file.]*

**Scoring criterion:** 1 point for each test not taken from the statement. Total — 20 points

**Maximum score for the task — 20**

**Solution.**

Let $v_1 \ge v_2 \ge \ldots$ be the numbers of votes for the classes. If there are several leaders ($v_1 = v_2$), it is enough to add one model to any of them: the set of winners will change. If the leader is unique ($v_1 > v_2$), the simplest way to change the decision is to bring the nearest pursuer up to a tie: exactly $v_1 - v_2$ models voting for the class with $v_2$ have to be added.

```python
n = int(input())
v = [int(input()) for _ in range(n)]
v.sort(reverse=True)
print(1 if v[0] == v[1] else v[0] - v[1])
```
