Little Artem and 2-SAT

2020 VietMX 0

Little Artem is a very smart programmer. He knows many different difficult algorithms. Recently he has mastered in 2-SAT one. In computer science, 2-satisfiability (abbreviated as 2-SAT) is […]

Bear and Colors

2020 VietMX 0

Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color t i. […]

Bear and Two Paths

2020 VietMX 0

Bearland has n cities, numbered 1 through n. Cities are connected via bidirectional roads. Each road connects two distinct cities. No two roads connect the same pair of cities. Bear […]

Levels and Regions

2020 VietMX 0

Radewoosh is playing a computer game. There are n levels, numbered 1 through n. Levels are divided into k regions (groups). Each region contains some positive number of consecutive levels. The game […]

Bears and Juice

2020 VietMX 0

There are n bears in the inn and p places to sleep. Bears will party together for some number of nights (and days). Bears love drinking juice. They don’t […]

NP-Hard Problem

2020 VietMX 0

Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting. Suppose the graph G is given. Subset A of its vertices […]

Remainders Game

2020 VietMX 0

Today Pari and Arya are playing a game called Remainders. Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value . […]

The Values You Can Make

2020 VietMX 0

Pari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is c i. The price of the chocolate is k, so Pari […]

TOF

2020 VietMX 3

Today Pari gave Arya a cool graph problem. Arya wrote a non-optimal solution for it, because he believes in his ability to optimize non-optimal solutions. […]

Robbers’ watch

2020 VietMX 0

Robbers, who attacked the Gerda’s cab, are very successful in covering from the kingdom police. To make the goal of catching them even harder, they […]

Kay and Snowflake

2020 VietMX 0

After the piece of a devilish mirror hit the Kay’s eye, he is no longer interested in the beauty of the roses. Now he likes […]

Optimal Point

2020 VietMX 0

When the river brought Gerda to the house of the Old Lady who Knew Magic, this lady decided to make Gerda her daughter. She wants […]

Kay and Eternity

2020 VietMX 0

Snow Queen told Kay to form a word “eternity” using pieces of ice. Kay is eager to deal with the task, because he will then […]

LRU

2020 VietMX 0

While creating high loaded systems one should pay a special attention to caching. This problem will be about one of the most popular caching algorithms […]

Break Up

2020 VietMX 21

Again, there are hard times in Berland! Many towns have such tensions that even civil war is possible. There are n towns in Reberland, some pairs of […]

Cron

2020 VietMX 0

Sometime the classic solution are not powerful enough and we have to design our own. For the purpose of this problem you have to implement […]

Huffman Coding on Segment

2020 VietMX 0

Alice wants to send an important message to Bob. Message a = (a 1, …, a n) is a sequence of positive integers (characters). To compress the message Alice wants to use binary […]