Book of Evil

2020 VietMX 0

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

Optimize!

2020 VietMX 0

Manao is solving a problem with the following statement: He came up with a solution that produces the correct answers but is too slow. You […]

Quiz

2020 VietMX 0

Manao is taking part in a quiz. The quiz consists of n consecutive questions. A correct answer gives one point to the player. The game also has […]

Divisor Tree

2020 VietMX 2

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

GCD Table

2020 VietMX 0

Consider a table G of size n × m such that G(i, j) = GCD(i, j) for all 1 ≤ i ≤ n, 1 ≤ j ≤ m. GCD(a, b) is the greatest common divisor of numbers a and b. You have a sequence of positive integer numbers a 1, a 2, …, a k. We say that this sequence […]

Rational Resistance

2020 VietMX 0

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. […]

Alternating Current

2020 VietMX 0

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

Read Time

2020 VietMX 0

Mad scientist Mike does not use slow hard disks. His modification of a hard drive has not one, but n different heads that can read data in […]

Water Tree

2020 VietMX 0

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. […]

Pumping Stations

2020 VietMX 0

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 and Hamming

2020 VietMX 0

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 . […]

Knight Tournament

2020 VietMX 0

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

Compartments

2020 VietMX 0

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

Bags and Coins

2020 VietMX 0

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 ans Anagrams

2020 VietMX 0

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

Sereja and the Arrangement of Numbers

2020 VietMX 0

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 and Algorithm

2020 VietMX 0

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 and Sets

2020 VietMX 0

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 and Intervals

2020 VietMX 0

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

Counting Kangaroos is Fun

2020 VietMX 0

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