Mateusz and an Infinite Sequence

2020 VietMX 0

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 […]

Flowers and Chocolate

2020 VietMX 0

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 […]

The Child and Binary Tree

2020 VietMX 0

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 […]

Epic Convolution

2020 VietMX 0

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} […]

Parity

2020 VietMX 1

You are given an integer $n$ ($n \ge 0$) represented with $k$ digits in base (radix) $b$. So, $$n = a_1 \cdot b^{k-1} + a_2 […]

Tape

2020 VietMX 0

You have a long stick, consisting of $m$ segments enumerated from $1$ to $m$. Each segment is $1$ centimeter long. Sadly, some segments are broken […]

Meaningless Operations

2020 VietMX 0

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 […]

Magic Stones

2020 VietMX 0

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 […]

Jongmah

2020 VietMX 0

You are playing a game of Jongmah. You don’t need to know the rules to solve this problem. You have $n$ tiles in your hand. […]

Tree-Tac-Toe

2020 VietMX 0

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 […]

Nearest Leaf

2020 VietMX 0

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 […]

Frets On Fire

2020 VietMX 0

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 and Triangles

2020 VietMX 0

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 […]

Love “A”

2020 VietMX 0

Alice has a string $s$. She really likes the letter “a”. She calls a string good if strictly more than half of the characters in […]

Hate “A”

2020 VietMX 2

Bob has a string $s$ consisting of lowercase English letters. He defines $s’$ to be the string after removing all “a” characters from $s$ (keeping […]

Tree Diameter

2020 VietMX 0

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 […]