Circle of Monsters

2020 VietMX 0

You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ […]

Minimum Euler Cycle

2020 VietMX 0

You are given a complete directed graph $K_n$ with $n$ vertices: each pair of vertices $u \neq v$ in $K_n$ have both directed edges $(u, v)$ and […]

Divisor Paths

2020 VietMX 1

You are given a positive integer $D$. Let’s build the following graph from it: each vertex is a divisor of $D$ (not necessarily prime, $1$ […]

Strange Function

2020 VietMX 0

Let’s denote the following function $f$. This function takes an array $a$ of length $n$ and returns an array. Initially the result is an empty […]

Substring Search

2020 VietMX 0

You are given a permutation $p$ consisting of exactly $26$ integers from $1$ to $26$ (since it is a permutation, each integer from $1$ to […]

Bracket Sequence

2020 VietMX 87

A bracket sequence is a string, containing only characters “(“, “)”, “[” and “]”. A correct bracket sequence is a bracket sequence that can be transformed into a correct […]

Barcode

2020 VietMX 0

You’ve got an n × m pixel picture. Each pixel can be white or black. Your task is to change the colors of as few pixels as possible to […]

Dice Tower

2020 VietMX 0

A dice is a cube, its faces contain distinct integers from 1 to 6 as black points. The sum of numbers at the opposite dice […]

Unsolvable

2020 VietMX 0

Consider the following equation:where sign [a] represents the integer part of number a. Let’s find all integer z (z > 0), for which this equation is unsolvable in positive integers. The phrase “unsolvable in […]

Well-known Numbers

2020 VietMX 0

Numbers k-bonacci ( k is integer, k > 1) are a generalization of Fibonacci numbers and are determined as follows: F(k, n) = 0, for integer n, 1 ≤ n < k; F(k, k) = 1; F(k, n) = F(k, n - 1) + F(k, n - 2) + … + F(k, n - k), for integer n, n > k. Note that we determine […]

Snake

2020 VietMX 0

Let us remind you the rules of a very popular game called “Snake” (or sometimes “Boa”, “Python” or “Worm”). The game field is represented by […]

Table

2020 VietMX 0

John Doe has an n × m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants […]

Cycles

2020 VietMX 0

John Doe started thinking about graphs. After some thought he decided that he wants to paint an undirected graph, containing exactly k cycles of length 3. A cycle […]

Fence Planks

2020 VietMX 0

John Doe has a crooked fence, consisting of n rectangular planks, lined up from the left to the right: the plank that goes i-th (1 ≤ i ≤ n) (from left to right) has […]

Practice

2020 VietMX 0

Little time is left before Berland annual football championship. Therefore the coach of team “Losewille Rangers” decided to resume the practice, that were indefinitely interrupted […]

Fence

2020 VietMX 0

Vasya should paint a fence in front of his own cottage. The fence is a sequence of n wooden boards arranged in a single row. Each board […]

Cinema

2020 VietMX 0

Overall there are m actors in Berland. Each actor has a personal identifier — an integer from 1 to m (distinct actors have distinct identifiers). Vasya likes to watch Berland movies […]

TorCoder

2020 VietMX 0

A boy named Leo doesn’t miss a single TorCoder contest round. On the last TorCoder round number 100666 Leo stumbled over the following problem. He […]