
ACM


Lost Array
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
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
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
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
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 […]

The Tower is Going Home
On a chessboard with a width of $10^9$ and a height of $10^9$, the rows are numbered from bottom to top from $1$ to $10^9$, […]

Optimal Polygon Perimeter
You are given $n$ points on the plane. The polygon formed from all the $n$ points is strictly convex, that is, the polygon is convex, and […]

Deduction Queries
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 […]

Intersecting Subtrees
You are playing a strange game with Li Chen. You have a tree with $n$ nodes drawn on a piece of paper. All nodes are […]



Alice and Hairdresser
Alice’s hair is growing by leaps and bounds. Maybe the cause of it is the excess of vitamins, or maybe it is some black magic… […]

Lucky Days
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 […]

Segments on the Line
You are a given a list of integers $a_1, a_2, \ldots, a_n$ and $s$ of its segments $[l_j; r_j]$ (where $1 \le l_j \le r_j […]

Tree and XOR
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
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
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
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
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 […]