Worms

2020 VietMX 0

It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch. Marmot brought Mole n ordered piles of worms such that i-th pile […]

Captain Marmot

2020 VietMX 0

Captain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this battle he has n regiments, each consisting of 4 moles. Initially, each […]

Flowers

2020 VietMX 0

We saw the little game Marmot made for Mole’s lunch. Now it’s Marmot’s dinner time and, as we all know, Marmot eats flowers. At every […]

Ant colony

2020 VietMX 0

Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength s i. In order to make his […]

Pillars

2020 VietMX 0

Marmot found a row with n pillars. The i-th pillar has the height of h i meters. Starting from one pillar i 1, Marmot wants to jump on the pillars i 2, …, i k. (1 ≤ i 1 < i 2 < … < i k ≤ n). From […]

Diverse Permutation

2020 VietMX 0

Permutation p is an ordered set of integers p 1,   p 2,   …,   p n, consisting of n distinct positive integers not larger than n. We’ll denote as n the length of permutation p 1,   p 2,   …,   p n. Your task is to find such […]

Interesting Array

2020 VietMX 0

We’ll call an array of n non-negative integers a[1], a[2], …, a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers l i, r i, q i (1 ≤ l i ≤ r i ≤ n) meaning that value  should be equal to q i. Your task is […]

Random Function and Tree

2020 VietMX 0

You have a rooted tree consisting of n vertices. Let’s number them with integers from 1 to n inclusive. The root of the tree is the vertex 1. For each i > 1 direct parent of […]

Game with Strings

2020 VietMX 0

You play the game with your friend. The description of this game is listed below. Your friend creates n distinct strings of the same length m and tells you […]

ELCA

2020 VietMX 0

You have a root tree containing n vertexes. Let’s number the tree vertexes with integers from 1 to n. The tree root is in the vertex 1. Each vertex (except fot […]

Vanya and Lanterns

2020 VietMX 0

Vanya walks late at night along a straight street of length l, lit by n lanterns. Consider the coordinate system with the beginning of the street corresponding to […]

Vanya and Cubes

2020 VietMX 0

Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must […]

Vanya and Exams

2020 VietMX 0

Vanya wants to pass n exams and get the academic scholarship. He will get the scholarship if the average grade mark for all the exams is at […]

Vanya and Field

2020 VietMX 0

Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (x i, y i). Vanya moves towards […]

Vanya and Computer Game

2020 VietMX 0

Vanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya’s character performs attack with frequency x hits per […]

Treasure

2020 VietMX 0

Malek has recently found a treasure map. While he was looking for a treasure he found a locked door. There was a string s written on the […]

Obsessive String

2020 VietMX 0

Hamed has recently found a string t and suddenly became quite fond of it. He spent several days trying to find all occurrences of t in other strings he […]

Sharti

2020 VietMX 0

During the last 24 hours Hamed and Malek spent all their time playing “Sharti”. Now they are too exhausted to finish the last round. So […]

Helping People

2020 VietMX 0

Malek is a rich man. He also is very generous. That’s why he decided to split his money between poor people. A charity institute knows n poor […]

Birthday

2020 VietMX 0

Ali is Hamed’s little brother and tomorrow is his birthday. Hamed wants his brother to earn his gift so he gave him a hard programming […]