Flights

2020 VietMX 0

LiLand is a country, consisting of n cities. The cities are numbered from 1 to n. The country is well known because it has a very strange transportation […]

Race

2020 VietMX 0

The Old City is a rectangular city represented as an m × n grid of blocks. This city contains many buildings, straight two-way streets and junctions. Each junction and […]

Friends

2020 VietMX 0

You have n friends and you want to take m pictures of them. Exactly two of your friends should appear in each picture and no two pictures should contain […]

Numbers

2020 VietMX 0

You have a sequence of n distinct integers a 1, a 2, …, a n (1 ≤ a i ≤ n). You want to remove some integers in such a way that the resulting sequence of integers satisfies the following […]

Not Wool Sequences

2020 VietMX 0

A sequence of non-negative integers a 1, a 2, …, a n of length n is called a wool sequence if and only if there exists two integers l and r (1 ≤ l ≤ r ≤ n) such that . In other words each wool sequence contains a […]

World Eater Brothers

2020 VietMX 0

You must have heard of the two brothers dreaming of ruling the world. With all their previous plans failed, this time they decided to cooperate […]

Boring Partition

2020 VietMX 1

This problem is the most boring one you’ve ever seen. Given a sequence of integers a 1, a 2, …, a n and a non-negative integer h, our goal is to partition the sequence […]

Meeting Her

2020 VietMX 0

Urpal lives in a big city. He has planned to meet his lover tonight. The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, […]

The Brand New Function

2020 VietMX 0

Polycarpus has a sequence, consisting of n non-negative integers: a 1, a 2, …, a n. Let’s define function f(l, r) ( l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all the sequence elements with indexes […]

Colorado Potato Beetle

2020 VietMX 0

Old MacDonald has a farm and a large potato field, (1010 + 1) × (1010 + 1) square meters in size. The field is divided into square garden beds, each bed takes up […]

Hydra

2020 VietMX 0

One day Petya got a birthday present from his mom: a book called “The Legends and Myths of Graph Theory”. From this book Petya learned […]

Points on Line

2020 VietMX 0

Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he […]

Playing with Permutations

2020 VietMX 0

Little Petya likes permutations a lot. Recently his mom has presented him permutation q 1, q 2, …, q n of length n. A permutation a of length n is a sequence of integers a 1, a 2, …, a n (1 ≤ a i ≤ n), all integers there are distinct. […]

Two Sets

2020 VietMX 0

Little Petya likes numbers a lot. Recently his mother has presented him a collection of n non-negative integers. There’s only one thing Petya likes more than numbers: […]

Number Transformation

2020 VietMX 0

Little Petya likes positive integers a lot. Recently his mom has presented him a positive integer a. There’s only one thing Petya likes more than numbers: […]

Adding Digits

2020 VietMX 0

Vasya has got two number: a and b. However, Vasya finds number a too short. So he decided to repeat the operation of lengthening number a n times. One operation of lengthening a […]

Ancient Prophesy

2020 VietMX 0

A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters […]

Balls and Boxes

2020 VietMX 0

Little Vasya had n boxes with balls in the room. The boxes stood in a row and were numbered with numbers from 1 to n from left to right. […]

Dividing Kingdom

2020 VietMX 0

A country called Flatland is an infinite two-dimensional plane. Flatland has n cities, each of them is a point on the plane. Flatland is ruled by king […]

Black and White Tree

2020 VietMX 0

The board has got a painted tree graph, consisting of n nodes. Let us remind you that a non-directed graph is called a tree if it is […]