
GCD Groups 2
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 […]
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 […]
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 […]
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 […]
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 […]
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 […]
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 […]
You are given an array $a$ of $n$ integers. You need to find the maximum value of $a_{i} | ( a_{j} \& a_{k} )$ over […]
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 […]
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 […]
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]$ […]
Polycarp likes to play with numbers. He takes some integer number $x$, writes it down on the board, and then performs with it $n – […]
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 […]
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 […]
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 […]
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 […]
The Golden Ring is the special tourist route in Berland. This route consists of $n$ cities and the cyclic railway route. Cities are numbered from $1$ […]