Road Repairs

2020 VietMX 0

A country named Berland has n cities. They are numbered with integers from 1 to n. City with index 1 is the capital of the country. Some pairs of cities have monodirectional […]

LCM Challenge

2020 VietMX 0

Some days ago, I learned the concept of LCM (least common multiple). I’ve played with it for several times and I want to make a […]

Let’s Play Osu!

2020 VietMX 0

You’re playing a game called Osu! Here’s a simplified version of it. There are n clicks in a game. For each click there are two outcomes: correct […]

Old Peykan

2020 VietMX 0

There are n cities in the country where the Old Peykan lives. These cities are located on a straight line, we’ll denote them from left to right […]

Mirror Box

2020 VietMX 0

Mirror Box is a name of a popular game in the Iranian National Amusement Park (INAP). There is a wooden box, 105 cm long and 100 cm high in […]

Challenging Balloons

2020 VietMX 0

Martha — as a professional problemsetter — proposed a problem for a world-class contest. This is the problem statement: Tomorrow is Nadia’s birthday, and Bardia […]

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