Bad Days

2020 VietMX 0

Every day Kotlin heroes analyze the statistics of their website. For $n$ days, they wrote out $n$ numbers $a_1, a_2, \dots, a_n$, where $a_i$ is […]

Minus and Minus Give Plus

2020 VietMX 0

Everyone knows that two consecutive (adjacent) “minus” signs can be replaced with a single “plus” sign. You are given the string $s$, consisting of “plus” […]

Wheels

2020 VietMX 0

Polycarp has $n$ wheels and a car with $m$ slots for wheels. The initial pressure in the $i$-th wheel is $a_i$. Polycarp’s goal is to […]

Sliding Doors

2020 VietMX 0

Imagine that you are the CEO of a big old-fashioned company. Unlike any modern and progressive company (such as JetBrains), your company has a dress […]

Longest Saw

2020 VietMX 0

You are given the sequence $a_1, a_2, \dots, a_n$. You can choose any subset of elements and then reorder them to create a “saw”. The […]

Graph Decomposition

2020 VietMX 0

You are given an undirected graph consisting of $n$ vertices and $m$ edges. Recall that a cycle is a path that starts and ends in […]

Good Subsets

2020 VietMX 2

You are given $n$ segments on the $Ox$ axis. The $i$-th segment is given as a pair $l_i, r_i$, where $l_i$ is the position of […]

Another One Bites The Dust

2020 VietMX 0

Let’s call a string good if and only if it consists of only two types of letters — ‘a’ and ‘b’ and every two consecutive letters are distinct. […]

Crazy Diamond

2020 VietMX 0

You are given a permutation $p$ of integers from $1$ to $n$, where $n$ is an even number. Your goal is to sort the permutation. […]

Born This Way

2020 VietMX 0

Arkady bought an air ticket from a city A to a city C. Unfortunately, there are no direct flights, but there are a lot of […]

Foo Fighters

2020 VietMX 0

You are given $n$ objects. Each object has two integer properties: $val_i$ — its price — and $mask_i$. It is guaranteed that the sum of all prices […]

Earth Wind and Fire

2020 VietMX 0

There are $n$ stones arranged on an axis. Initially the $i$-th stone is located at the coordinate $s_i$. There may be more than one stone […]

Gold Experience

2020 VietMX 0

Consider an undirected graph $G$ with $n$ vertices. There is a value $a_i$ in each vertex. Two vertices $i$ and $j$ are connected with an […]

MP3

2020 VietMX 0

One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative […]

Welfare State

2020 VietMX 0

There is a country with $n$ citizens. The $i$-th of them initially has $a_{i}$ money. The government strictly controls the wealth of its citizens. Whenever […]