Elections

2020 VietMX 0

Awruk is taking part in elections in his school. It is the final round. He has only one opponent — Elodreip. The are $n$ students in […]

Lost Array

2020 VietMX 0

Bajtek, known for his unusual gifts, recently got an integer array $x_0, x_1, \ldots, x_{k-1}$. Unfortunately, after a huge array-party with his extraordinary friends, he […]

Smallest Word

2020 VietMX 0

IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, ‘a’ or ‘b’. She loves to play with […]

Train Hard, Win Easy

2020 VietMX 0

Zibi is a competitive programming coach. There are $n$ competitors who want to be prepared well. The training contests are quite unusual – there are two […]

Make It One

2020 VietMX 0

Janusz is a businessman. He owns a company “Januszex”, which produces games for teenagers. Last hit of Januszex was a cool one-person game “Make it […]

Speckled Band

2020 VietMX 0

Ildar took a band (a thin strip of cloth) and colored it. Formally, the band has $n$ cells, each of them is colored into one […]

Deduction Queries

2020 VietMX 0

There is an array $a$ of $2^{30}$ integers, indexed from $0$ to $2^{30}-1$. Initially, you know that $0 \leq a_i < 2^{30}$ ($0 \leq i […]

Grid Sort

2020 VietMX 0

You are given an $n \times m$ grid. Each grid cell is filled with a unique integer from $1$ to $nm$ so that each integer […]

Metro

2020 VietMX 90

Alice has a birthday today, so she invited home her best friend Bob. Now Bob needs to find a way to commute to the Alice’s […]

Lucky Days

2020 VietMX 0

Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that […]

Tree and XOR

2020 VietMX 0

You are given a connected undirected graph without cycles (that is, a tree) of $n$ vertices, moreover, there is a non-negative integer written on every […]

Refactoring

2020 VietMX 0

Alice has written a program and now tries to improve its readability. One of the ways to improve readability is to give sensible names to […]

Definite Game

2020 VietMX 0

Chouti was doing a competitive programming competition. However, after having all the problems accepted, he got bored and decided to invent some small games. He […]

Colorful Bricks

2020 VietMX 4

On his free time, Chouti likes doing some housework. He has got one new task, paint some bricks in the yard. There are $n$ bricks […]

Maximum Distance

2020 VietMX 0

Chouti was tired of the tedious homework, so he opened up an old programming problem he created years ago. You are given a connected undirected […]