Antipalindrome

2020 VietMX 0

A string is a palindrome if it reads the same from the left to the right and from the right to the left. For example, […]

Businessmen Problems

2020 VietMX 0

Two famous competing companies ChemForces and TopChemist decided to show their sets of recently discovered chemical elements on an exhibition. However they know that no element should be present […]

Useful Decomposition

2020 VietMX 0

Ramesses knows a lot about problems involving trees (undirected connected graphs without cycles)! He created a new useful tree decomposition, but he does not know […]

Bookshelves

2020 VietMX 0

Mr Keks is a typical white-collar in Byteland. He has a bookshelf in his office with some books on it, each book has an integer […]

Addition on Segments

2020 VietMX 0

Grisha come to a contest and faced the following problem. You are given an array of size $n$, initially consisting of zeros. The elements of […]

Round Marriage

2020 VietMX 0

It’s marriage season in Ringland! Ringland has a form of a circle’s boundary of length $L$. There are $n$ bridegrooms and $n$ brides, and bridegrooms […]

Magic multisets

2020 VietMX 0

In the School of Magic in Dirtpolis a lot of interesting objects are studied on Computer Science lessons. Consider, for example, the magic multiset. If […]

K Paths

2020 VietMX 0

You are given a tree of $n$ vertices. You are to select $k$ (not necessarily distinct) simple paths in such a way that it is […]

Fair

2020 VietMX 0

Some company is going to hold a fair in Byteland. There are $n$ towns in Byteland and $m$ two-way roads between towns. Of course, you […]

Petr and Permutations

2020 VietMX 0

Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation […]

AND Graph

2020 VietMX 0

You are given a set of size $m$ with integer elements between $0$ and $2^{n}-1$ inclusive. Let’s build an undirected graph on these integers in […]

Prince’s Problem

2020 VietMX 0

Let the main characters of this problem be personages from some recent movie. New Avengers seem to make a lot of buzz. I didn’t watch […]

Perfect Encoding

2020 VietMX 0

You are working as an analyst in a company working on a new system for big data storage. This system will store $n$ different objects. […]

Packets

2020 VietMX 0

You have $n$ coins, each of the same value of $1$. Distribute them into packets such that any amount $x$ ($1 \leq x \leq n$) […]

Reach Median

2020 VietMX 0

You are given an array $a$ of $n$ integers and an integer $s$. It is guaranteed that $n$ is odd. In one operation you can […]

Equalize

2020 VietMX 0

You are given two binary strings $a$ and $b$ of the same length. You can perform the following two operations on the string $a$: Swap […]

Valid BFS?

2020 VietMX 0

The BFS algorithm is defined as follows. Consider an undirected graph with vertices numbered from $1$ to $n$. Initialize $q$ as a new queue containing only vertex $1$, mark […]

Trips

2020 VietMX 0

There are $n$ persons who initially don’t know each other. On each morning, two of them, who were not friends before, become friends. We want […]