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

Frog Jumping

2020 VietMX 0

A frog is initially at position $0$ on the number line. The frog has two positive integers $a$ and $b$. From a position $k$, it […]

Hot is Cold

2020 VietMX 0

You are given an array of $n$ integers $a_1, a_2, \ldots, a_n$. You will perform $q$ operations. In the $i$-th operation, you have a symbol […]

Leaf Partition

2020 VietMX 0

You are given a rooted tree with $n$ nodes, labeled from $1$ to $n$. The tree is rooted at node $1$. The parent of the […]

Satanic Panic

2020 VietMX 1

You are given a set of $n$ points in a 2D plane. No three points are collinear. A pentagram is a set of $5$ points […]

Three Integers Again

2020 VietMX 0

We have three positive integers $a$, $b$ and $c$. You don’t know their values, but you know some information about them. Consider all three pairwise sums, i.e. […]