Subarray Cuts

2020 VietMX 0

You are given an array of length n and a number k. Let’s pick k non-overlapping non-empty subarrays of the initial array. Let s i be the sum of the i-th subarray in order […]

Scaygerboss

2020 VietMX 0

Cthulhu decided to catch Scaygerboss. Scaygerboss found it out and is trying to hide in a pack of his scaygers. Each scayger except Scaygerboss is […]

Inversions problem

2020 VietMX 0

You are given a permutation of n numbers p 1, p 2, …, p n. We perform k operations of the following type: choose uniformly at random two indices l and r ( l ≤ r) and reverse the order of the elements p l, p l + 1, …, p r. […]

Photo to Remember

2020 VietMX 0

One day n friends met at a party, they hadn’t seen each other for a long time and so they decided to make a group photo together. […]

Chicken or Fish?

2020 VietMX 0

Polycarp is flying in the airplane. Finally, it is his favorite time — the lunchtime. The BerAvia company stewardess is giving food consecutively to all the […]

Reposts

2020 VietMX 0

One day Polycarp published a funny picture in a social network making a poll about the color of his handle. Many of his friends started […]

Closest Equals

2020 VietMX 0

You are given sequence a 1, a 2, …, a n and m queries l j, r j (1 ≤ l j ≤ r j ≤ n). For each query you need to print the minimum distance between such pair of elements a x and a y ( x ≠ y), that: both indexes of the elements […]

Rooks and Rectangles

2020 VietMX 2

Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn’t yet invented the rules of the game he will play. However, he has already […]

Social Network

2020 VietMX 0

Polycarpus got an internship in one well-known social network. His test task is to count the number of unique users who have visited a social […]

King of Thieves

2020 VietMX 0

In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called “King of Thieves” your aim […]

Om Nom and Candies

2020 VietMX 0

A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think […]

Om Nom and Necklace

2020 VietMX 0

One day Om Nom found a thread with n beads of different colors. He decided to cut the first several beads from this thread to make a […]

Transmitting Levels

2020 VietMX 0

Optimizing the amount of data transmitted via a network is an important and interesting part of developing any network application. In one secret game developed […]

Correcting Mistakes

2020 VietMX 0

Analyzing the mistakes people make while typing search queries is a complex and an interesting work. As there is no guaranteed way to determine what […]

Work Group

2020 VietMX 0

One Big Software Company has n employees numbered from 1 to n. The director is assigned number 1. Every employee of the company except the director has exactly one immediate superior. […]

Board Game

2020 VietMX 0

Polycarp and Vasiliy love simple logical games. Today they play a game with infinite chessboard and one pawn for each player. Polycarp and Vasiliy move […]

Encoding

2020 VietMX 0

Polycarp invented a new way to encode strings. Let’s assume that we have string T, consisting of lowercase English letters. Let’s choose several pairs of letters […]