Party

2020 VietMX 0

Note the unusual memory limit for the problem. People working in MDCS (Microsoft Development Center Serbia) like partying. They usually go to night clubs on […]

Power Products

2020 VietMX 0

You are given $n$ positive integers $a_1, \ldots, a_n$, and an integer $k \geq 2$. Count the number of pairs $i, j$ such that $1 […]

P-binary

2020 VietMX 0

Vasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only […]

Rock Is Push

2020 VietMX 0

You are at the top left cell $(1, 1)$ of an $n \times m$ labyrinth. Your goal is to get to the bottom right cell […]

Tree Factory

2020 VietMX 0

Bytelandian Tree Factory produces trees for all kinds of industrial applications. You have been tasked with optimizing the production of a certain type of tree […]

Cursor Distance

2020 VietMX 0

There is a string $s$ of lowercase English letters. A cursor is positioned on one of the characters. The cursor can be moved with the […]

Messy

2020 VietMX 0

You are fed up with your messy room, so you decided to clean it up. Your room is a bracket sequence $s=s_{1}s_{2}\dots s_{n}$ of length […]

Not Same

2020 VietMX 0

You are given an integer array $a_1, a_2, \dots, a_n$, where $a_i$ represents the number of blocks at the $i$-th position. It is guaranteed that […]

Arson In Berland Forest

2020 VietMX 0

The Berland Forest can be represented as an infinite cell plane. Every cell contains a tree. That is, contained before the recent events. A destructive […]

Xor-Set

2020 VietMX 0

You are given two sets of integers: $A$ and $B$. You need to output the sum of elements in the set $C = \{x | […]

Beautiful Sequence

2020 VietMX 0

An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $1$. More formally, a sequence $s_1, s_2, \ldots, s_{n}$ is […]

Beautiful League

2020 VietMX 0

A football league has recently begun in Beautiful land. There are $n$ teams participating in the league. Let’s enumerate them with integers from $1$ to […]