
Infinite Path
You are given a colored permutation $p_1, p_2, \dots, p_n$. The $i$-th element of the permutation has color $c_i$. Let’s define an infinite path as infinite sequence […]
You are given a colored permutation $p_1, p_2, \dots, p_n$. The $i$-th element of the permutation has color $c_i$. Let’s define an infinite path as infinite sequence […]
Petya has a rectangular Board of size $n \times m$. Initially, $k$ chips are placed on the board, $i$-th chip is located in the cell […]
You wrote down all integers from $0$ to $10^n – 1$, padding them with leading zeroes so their lengths are exactly $n$. For example, if […]
The King of Berland Polycarp LXXXIV has $n$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the […]
You are given a string $S$ and an array of strings $[t_1, t_2, \dots, t_k]$. Each string $t_i$ consists of lowercase Latin letters from a to n; $S$ […]
You are given three integers $n$, $k$, $m$ and $m$ conditions $(l_1, r_1, x_1), (l_2, r_2, x_2), \dots, (l_m, r_m, x_m)$. Calculate the number of […]
Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice’s cat is located […]
A positive integer is called composite if it can be represented as a product of two positive integers, both greater than $1$. For example, the following numbers […]
Word $s$ of length $n$ is called $k$-complete if $s$ is a palindrome, i.e. $s_i=s_{n+1-i}$ for all $1 \le i \le n$; $s$ has a […]
Bob is playing a game named “Walk on Matrix”. In this game, player is given an $n \times m$ matrix $A=(a_{i,j})$, i.e. the element in […]
Eric is the teacher of graph theory class. Today, Eric teaches independent set and edge-induced subgraph. Given a graph $G=(V,E)$, an independent set is a subset of […]
Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an $n \times m$ grid. Initially $a_{i,j}$ cubes are stacked […]
Young boy Artem tries to paint a picture, and he asks his mother Medina to help him. Medina is very busy, that’s why she asked […]
Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem: There are two arrays […]
Eugene likes working with arrays. And today he needs your help in solving one challenging task. An array $c$ is a subarray of an array […]
Kate has a set $S$ of $n$ integers $\{1, \dots, n\} $. She thinks that imperfection of a subset $M \subseteq S$ is equal to the maximum of $gcd(a, […]
There are $n$ children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a […]
Egor wants to achieve a rating of 1600 points on the well-known chess portal ChessForces and he needs your help! Before you start solving the […]
Polycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all over the […]
Many years ago Berland was a small country where only $n$ people lived. Each person had some savings: the $i$-th one had $a_i$ burles. The […]