Graph Reconstruction

2020 VietMX 0

I have an undirected graph consisting of n nodes, numbered 1 through n. Each node has at most two incident edges. For each pair of nodes, there is […]

Banana

2020 VietMX 0

Piegirl is buying stickers for a project. Stickers come on sheets, and each sheet of stickers contains exactly n stickers. Each sticker has exactly one character printed […]

More Reclamation

2020 VietMX 0

In a far away land, there are two cities near a river. One day, the cities decide that they have too little space and would […]

Palindrome

2020 VietMX 0

Given a string s, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn’t […]

Rectangles and Square

2020 VietMX 0

You are given n rectangles, labeled 1 through n. The corners of rectangles have integer coordinates and their edges are parallel to the Ox and Oy axes. The rectangles may touch each […]

Counting Skyscrapers

2020 VietMX 0

A number of skyscrapers have been built in a line. The number of skyscrapers was chosen uniformly at random between 2 and 314! (314 factorial, a very large number). […]

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