
Meaningless Operations
Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question. Suppose you are given a positive […]
Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question. Suppose you are given a positive […]
Grigory has n magic stones, conveniently numbered from 1 to n. The charge of the i-th stone is equal to ci. Sometimes Grigory gets bored and selects […]
The tic-tac-toe game is starting on a tree of n vertices. Some vertices are already colored in white while the remaining are uncolored. There are […]
Let’s define the Eulerian traversal of a tree (a connected undirected graph without cycles) as follows: consider a depth-first search algorithm which traverses vertices of […]
Ilya lives in a beautiful city of Chordalsk. There are n houses on the street Ilya lives, they are numerated from 1 to n from […]
Alyona has recently bought a miniature fridge that can be represented as a matrix with h rows and 2 columns. Initially there is only one […]
Ramesses came to university to algorithms practice, and his professor, who is a fairly known programmer, gave him the following task. You are given two […]
Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day. […]
Pavel has several sticks with lengths equal to powers of two. He has a0 sticks of length 20=1, a1 sticks of length $2^1 […]
Niyaz has a tree with n vertices numerated from 1 to n. A tree is a connected graph without cycles. Each edge in this tree […]
There is a weighted tree with n nodes and n−1 edges. The nodes are conveniently labeled from 1 to n. The weights are positive integers […]
A frog is initially at position 0 on the number line. The frog has two positive integers a and b. From a position k, it […]
You are given an array of n integers a1,a2,…,an. You will perform q operations. In the i-th operation, you have a symbol […]
You are planning to build housing on a street. There are n spots available on the street on which you can build a house. The […]
You are given a rooted tree with n nodes, labeled from 1 to n. The tree is rooted at node 1. The parent of the […]
You are given a set of n points in a 2D plane. No three points are collinear. A pentagram is a set of 5 points […]
We have three positive integers a, b and c. You don’t know their values, but you know some information about them. Consider all three pairwise sums, i.e. […]