
Antipalindrome
A string is a palindrome if it reads the same from the left to the right and from the right to the left. For example, […]
A string is a palindrome if it reads the same from the left to the right and from the right to the left. For example, […]
Two famous competing companies ChemForces and TopChemist decided to show their sets of recently discovered chemical elements on an exhibition. However they know that no element should be present […]
Ramesses knows a lot about problems involving trees (undirected connected graphs without cycles)! He created a new useful tree decomposition, but he does not know […]
Mr Keks is a typical white-collar in Byteland. He has a bookshelf in his office with some books on it, each book has an integer […]
Grisha come to a contest and faced the following problem. You are given an array of size $n$, initially consisting of zeros. The elements of […]
It’s marriage season in Ringland! Ringland has a form of a circle’s boundary of length $L$. There are $n$ bridegrooms and $n$ brides, and bridegrooms […]
In the School of Magic in Dirtpolis a lot of interesting objects are studied on Computer Science lessons. Consider, for example, the magic multiset. If […]
Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation […]
Surely you have seen insane videos by South Korean rapper PSY, such as “Gangnam Style”, “Gentleman” and “Daddy”. You might also hear that PSY has […]
Let the main characters of this problem be personages from some recent movie. New Avengers seem to make a lot of buzz. I didn’t watch […]
You are working as an analyst in a company working on a new system for big data storage. This system will store $n$ different objects. […]
You are given an array $a$ of $n$ integers and an integer $s$. It is guaranteed that $n$ is odd. In one operation you can […]
The BFS algorithm is defined as follows. Consider an undirected graph with vertices numbered from $1$ to $n$. Initialize $q$ as a new queue containing only vertex $1$, mark […]
Given an array $a$ of $n$ integers and an integer $k$ ($2 \le k \le n$), where each element of the array is denoted by […]