
Mateusz and an Infinite Sequence
A Thue-Morse-Radecki-Mateusz sequence (Thorse-Radewoosh sequence in short) is an infinite sequence constructed from a finite sequence $\mathrm{gen}$ of length $d$ and an integer $m$, obtained in the […]
A Thue-Morse-Radecki-Mateusz sequence (Thorse-Radewoosh sequence in short) is an infinite sequence constructed from a finite sequence $\mathrm{gen}$ of length $d$ and an integer $m$, obtained in the […]
It’s Piegirl’s birthday soon, and Pieguy has decided to buy her a bouquet of flowers and a basket of chocolates. The flower shop has F different types […]
Our child likes computer science very much, especially he likes binary trees. Consider the sequence of n distinct positive integers: c 1, c 2, …, c n. The child calls a vertex-weighted rooted binary […]
You are given two arrays $a_0, a_1, \ldots, a_{n – 1}$ and $b_0, b_1, \ldots, b_{m-1}$, and an integer $c$. Compute the following sum: $$\sum_{i=0}^{n-1} […]
Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question. Suppose you are given a positive […]
Grigory has $n$ magic stones, conveniently numbered from $1$ to $n$. The charge of the $i$-th stone is equal to $c_i$. Sometimes Grigory gets bored and selects […]
The tic-tac-toe game is starting on a tree of $n$ vertices. Some vertices are already colored in white while the remaining are uncolored. There are […]
Let’s define the Eulerian traversal of a tree (a connected undirected graph without cycles) as follows: consider a depth-first search algorithm which traverses vertices of […]
Ilya lives in a beautiful city of Chordalsk. There are $n$ houses on the street Ilya lives, they are numerated from $1$ to $n$ from […]
Alyona has recently bought a miniature fridge that can be represented as a matrix with $h$ rows and $2$ columns. Initially there is only one […]
Ramesses came to university to algorithms practice, and his professor, who is a fairly known programmer, gave him the following task. You are given two […]
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day. […]
Pavel has several sticks with lengths equal to powers of two. He has $a_0$ sticks of length $2^0 = 1$, $a_1$ sticks of length $2^1 […]
Niyaz has a tree with $n$ vertices numerated from $1$ to $n$. A tree is a connected graph without cycles. Each edge in this tree […]
There is a weighted tree with $n$ nodes and $n-1$ edges. The nodes are conveniently labeled from $1$ to $n$. The weights are positive integers […]