GCD Groups 2

2020 VietMX 1

You are given an array of $n$ integers. You need to split all integers into two groups so that the GCD of all integers in […]

Mysterious Crime

2020 VietMX 0

Acingel is a small town. There was only one doctor here — Miss Ada. She was very friendly and nobody has ever said something bad about […]

XORinacci

2020 VietMX 0

Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his […]

Uniqueness

2020 VietMX 0

You are given an array $a_{1}, a_{2}, \ldots, a_{n}$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct. In other […]

Restore Permutation

2020 VietMX 0

An array of integers $p_{1},p_{2}, \ldots,p_{n}$ is called a permutation if it contains each number from $1$ to $n$ exactly once. For example, the following […]

Magic Grid

2020 VietMX 0

Let us define a magic grid to be a square matrix of integers of size $n \times n$, satisfying the following conditions. All integers from $0$ to […]

Let Them Slide

2020 VietMX 0

You are given $n$ arrays that can have different sizes. You also have a table with $w$ columns and $n$ rows. The $i$-th array is […]

Bits And Pieces

2020 VietMX 0

You are given an array $a$ of $n$ integers. You need to find the maximum value of $a_{i} | ( a_{j} \& a_{k} )$ over […]

Polygons

2020 VietMX 0

You are given two integers $n$ and $k$. You need to construct $k$ regular polygons having same circumcircle, with distinct number of sides $l$ between $3$ and $n$. […]

Red Blue Tree

2020 VietMX 0

You are given a tree of $n$ nodes. The tree is rooted at node $1$, which is not considered as a leaf regardless of its […]

Wrong Subtraction

2020 VietMX 0

Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more […]

Less or Equal

2020 VietMX 0

You are given a sequence of integers of length $n$ and integer number $k$. You should print any integer number $x$ in the range of $[1; 10^9]$ […]

Booking System

2020 VietMX 0

Innovation technologies are on a victorious march around the planet. They integrate into all spheres of human activity! A restaurant called “Dijkstra’s Place” has started […]

Two-gram

2020 VietMX 0

Two-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, “AZ”, “AA”, “ZA” — three distinct two-grams. You are […]

Hiking

2020 VietMX 0

A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from […]

One-Based Arithmetic

2020 VietMX 0

Prof. Vasechkin wants to represent positive integer n as a sum of addends, where each addends is an integer number containing only 1s. For example, he can represent […]

Berland Federalization

2020 VietMX 4

Recently, Berland faces federalization requests more and more often. The proponents propose to divide the country into separate states. Moreover, they demand that there is […]

Three Problems

2020 VietMX 0

Polycarp is choosing three problems for creating a programming test. Totally he has $n$ problems in his list. The complexity of the $i$-th problem equals […]