
Book of Evil
Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the […]
Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the […]
A divisor tree is a rooted tree that meets the following conditions: Each vertex of the tree contains a positive integer number. The numbers written in the […]
Mad scientist Mike is building a time machine in his spare time. To finish the work, he needs a resistor with a certain resistance value. […]
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for […]
Mad scientist Mike has constructed a rooted tree, which consists of n vertices. Each vertex is a reservoir which can be either empty or filled with water. […]
Mad scientist Mike has applied for a job. His task is to manage a system of water pumping stations. The system consists of n pumping stations, which […]
Xenia is an amateur programmer. Today on the IT lesson she learned about the Hamming distance. The Hamming distance between two strings s = s 1 s 2… s n and t = t 1 t 2… t n of equal length n is value . […]
Hooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all knights in the kingdom […]
A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have […]
When you were a child you must have been told a puzzle of bags and coins. Anyway, here’s one of its versions: A horse has […]
Sereja has two sequences a and b and number p. Sequence a consists of n integers a 1, a 2, …, a n. Similarly, sequence b consists of m integers b 1, b 2, …, b m. As usual, Sereja studies the sequences he has. Today he wants to find the number […]
Let’s call an array consisting of n integer numbers a 1, a 2, …, a n, beautiful if it has the following property: consider all pairs of numbers x, y (x ≠ y), such that number x occurs in the array a and number y occurs in […]
Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let’s represent the […]
Sereja has m non-empty sets of integers A 1, A 2, …, A m. What a lucky coincidence! The given sets are a partition of the set of all integers from 1 to n. In […]
Sereja is interested in intervals of numbers, so he has prepared a problem about intervals for you. An interval of numbers is a pair of […]
There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo’s pocket if and only if the size […]