Ice Cream

2020 VietMX 0

Summer in Berland lasts $n$ days, the price of one portion of ice cream on the $i$-th day is $c_i$. Over the summer, Tanya wants […]

Teams

2020 VietMX 0

There are $n$ table bowling players, the rating of the $i$-th player equals $r_i$. Compose a maximum number of teams in a such way that: […]

Double Permutation Inc

2020 VietMX 0

Polycarp recently became an employee of the company “Double Permutation Inc.” Now he is a fan of permutations and is looking for them everywhere! A […]

King’s Path

2020 VietMX 0

There are $n$ cities and $n-1$ two-way roads in Treeland. Each road connects a pair of different cities. From any city you can drive to […]

Unusual Graph

2020 VietMX 0

Ivan on his birthday was presented with array of non-negative integers $a_1, a_2, \ldots, a_n$. He immediately noted that all $a_i$ satisfy the condition $0 […]

Paint the Numbers

2020 VietMX 0

You are given a sequence of integers $a_1, a_2, \dots, a_n$. You need to paint elements in colors, so that: If we consider any color, […]

Koala and Lights

2020 VietMX 0

It is a holiday season, and Koala is decorating his house with cool lights! He owns $n$ lights, all of which flash periodically. After taking […]

Paint the Digits

2020 VietMX 85

You are given a sequence of $n$ digits $d_1d_2 \dots d_{n}$. You need to paint all the digits in two colors so that: each digit […]

Cow and Snacks

2020 VietMX 0

The legendary Farmer John is throwing a huge party, and animals from all over the world are hanging out at his house. His guests are […]

Koala and Notebook

2020 VietMX 0

Koala Land consists of $m$ bidirectional roads connecting $n$ cities. The roads are numbered from $1$ to $m$ by order in input. It is guaranteed, […]

Party

2020 VietMX 0

Note the unusual memory limit for the problem. People working in MDCS (Microsoft Development Center Serbia) like partying. They usually go to night clubs on […]

Power Products

2020 VietMX 0

You are given $n$ positive integers $a_1, \ldots, a_n$, and an integer $k \geq 2$. Count the number of pairs $i, j$ such that $1 […]

P-binary

2020 VietMX 0

Vasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only […]

Rock Is Push

2020 VietMX 0

You are at the top left cell $(1, 1)$ of an $n \times m$ labyrinth. Your goal is to get to the bottom right cell […]

Tree Factory

2020 VietMX 0

Bytelandian Tree Factory produces trees for all kinds of industrial applications. You have been tasked with optimizing the production of a certain type of tree […]

Cursor Distance

2020 VietMX 0

There is a string $s$ of lowercase English letters. A cursor is positioned on one of the characters. The cursor can be moved with the […]