Cow and Exercise

0

Farmer John is obsessed with making Bessie exercise more! Bessie is out grazing on the farm, which consists of $$$n$$$ fields connected by $$$m$$$ directed […]

Cow and Vacation

0

Bessie is planning a vacation! In Cow-lifornia, there are $$$n$$$ cities, with $$$n-1$$$ bidirectional roads connecting them. It is guaranteed that one can reach any […]

Two Regular Polygons

0

You are given two integers $$$n$$$ and $$$m$$$ ($$$m < n$$$). Consider a convex regular polygon of $$$n$$$ vertices. Recall that a regular polygon is a polygon […]

Bogosort

0

You are given an array $$$a_1, a_2, \dots , a_n$$$. Array is good if for each pair of indexes $$$i < j$$$ the condition $$$j […]

Adding Powers

0

Suppose you are performing the following algorithm. There is an array $$$v_1, v_2, \dots, v_n$$$ filled with zeroes at start. The following operation is applied […]

Count the Arrays

0

Your task is to calculate the number of arrays such that: each array contains $$$n$$$ elements; each element is an integer from $$$1$$$ to $$$m$$$; […]

Array Shrinking

0

You are given an array $$$a_1, a_2, \dots, a_n$$$. You can perform the following operation any number of times: Choose a pair of two neighboring […]

Attack on Red Kingdom

0

The Red Kingdom is attacked by the White King and the Black King! The Kingdom is guarded by $$$n$$$ castles, the $$$i$$$-th castle is defended […]

Auto completion

0

You are given a set of strings $$$S$$$. Each string consists of lowercase Latin letters. For each string in this set, you want to calculate […]

Ehab the Xorcist

0

Given 2 integers $$$u$$$ and $$$v$$$, find the shortest array such that bitwise-xor of its elements is $$$u$$$, and the sum of its elements is $$$v$$$. Input […]

Ehab and Path-etic MEXs

0

You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree’s edges such that the following conditions hold: […]

Ehab’s Last Theorem

0

It’s the year 5555. You have a graph, and you want to find a long cycle and a huge independent set, just because you can. […]

Sum of Odd Integers

0

You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not […]

Infinite Path

0

You are given a colored permutation $$$p_1, p_2, \dots, p_n$$$. The $$$i$$$-th element of the permutation has color $$$c_i$$$. Let’s define an infinite path as infinite sequence […]

Game with Chips

0

Petya has a rectangular Board of size $$$n \times m$$$. Initially, $$$k$$$ chips are placed on the board, $$$i$$$-th chip is located in the cell […]

Count The Blocks

0

You wrote down all integers from $$$0$$$ to $$$10^n – 1$$$, padding them with leading zeroes so their lengths are exactly $$$n$$$. For example, if […]

Princesses and Princes

0

The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the […]

Letters and Question Marks

0

You are given a string $$$S$$$ and an array of strings $$$[t_1, t_2, \dots, t_k]$$$. Each string $$$t_i$$$ consists of lowercase Latin letters from a to n; $$$S$$$ […]

AND Segments

0

You are given three integers $$$n$$$, $$$k$$$, $$$m$$$ and $$$m$$$ conditions $$$(l_1, r_1, x_1), (l_2, r_2, x_2), \dots, (l_m, r_m, x_m)$$$. Calculate the number of […]