Substitutes in Number

2020 VietMX 1

Andrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends Andrew multiple queries of type ” d i → t i“, that means “replace […]

Restore Cube

2020 VietMX 0

Peter had a cube with non-zero length of a side. He put the cube into three-dimensional space in such a way that its vertices lay […]

Cheap Travel

2020 VietMX 0

Ann has recently started commuting by subway. We know that a one ride subway ticket costs a rubles. Besides, Ann found out that she can buy a […]

Wonder Room

2020 VietMX 0

The start of the new academic year brought about the problem of accommodation students into dormitories. One of such dormitories has a a × b square meter wonder room. […]

Number of Ways

2020 VietMX 0

You’ve got array a[1], a[2], …, a[n], consisting of n integers. Count the number of ways to split all the elements of the array into three contiguous parts so that the […]

Increase Sequence

2020 VietMX 0

Peter has a sequence of integers a 1, a 2, …, a n. Peter wants all numbers in the sequence to equal h. He can perform the operation of “adding one on the […]

Information Graph

2020 VietMX 0

There are n employees working in company “X” (let’s number them from 1 to n for convenience). Initially the employees didn’t have any relationships among each other. On each […]

Keyboard

2020 VietMX 0

Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way: qwertyuiopasdfghjkl;zxcvbnm,./ […]

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