Borya and Hanabi

2020 VietMX 0

Have you ever played Hanabi? If not, then you’ve got to try it out! This problem deals with a simplified version of the game. Overall, […]

Andrey and Problem

2020 VietMX 0

Andrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to […]

Adam and Tree

2020 VietMX 1

When Adam gets a rooted tree (connected non-directed graph without cycles), he immediately starts coloring it. More formally, he assigns a color to each edge […]

Artem and Array

2020 VietMX 0

Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element […]

Gena and Second Distance

2020 VietMX 0

Gena doesn’t like geometry, so he asks you to solve this problem for him. A rectangle with sides parallel to coordinate axes contains n dots. Let’s consider […]

Eevee

2020 VietMX 0

You are solving the crossword problem K from IPSC 2014. You solved all the clues except for one: who does Eevee evolve into? You are […]

Magic Trick

2020 VietMX 0

Alex enjoys performing magic tricks. He has a trick that requires a deck of n cards. He has m identical decks of n different cards each, which have been mixed together. […]

4-point polyline

2020 VietMX 0

You are given a rectangular grid of lattice points from (0, 0) to (n, m) inclusive. You have to choose exactly 4 different points to build a polyline possibly with self-intersections […]

Washer, Dryer, Folder

2020 VietMX 0

You have k pieces of laundry, each of which you want to wash, dry and fold. You are at a laundromat that has n 1 washing machines, n 2 drying machines and n 3 folding machines. […]

Three strings

2020 VietMX 0

You are given three strings (s 1, s 2, s 3). For each integer l (1 ≤ l ≤ min(|s 1|, |s 2|, |s 3|) you need to find how many triples ( i 1, i 2, i 3) exist such that three strings s k[i k… i k + l - 1] (k = 1, 2, 3) are pairwise equal. Print all found […]

Boredom

2020 VietMX 0

Alex doesn’t like boredom. That’s why whenever he gets bored, he comes up with games. One long winter evening he came up with a game […]

A Lot of Games

2020 VietMX 0

Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players. Given a group of n non-empty strings. During the game […]

Civilization

2020 VietMX 0

Andrew plays a game called “Civilization”. Dima helps him. The game has n cities and m bidirectional roads. The cities are numbered from 1 to n. Between any pair of cities there […]

Serega and Fun

2020 VietMX 0

Serega loves fun. However, everyone has fun in the unique manner. Serega has fun by solving query problems. One day Fedor came up with such […]

Function

2020 VietMX 0

Serega and Fedor play with functions. One day they came across a very interesting function. It looks like that: f(1, j) = a[j], 1 ≤ j ≤ n. f(i, j) = min(f(i - 1, j), f(i - 1, j - 1)) + a[j], 2 ≤ i ≤ n, i ≤ j ≤ n. Here a is an integer array […]

Golden System

2020 VietMX 0

Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number , in particular that q 2 = q + 1, and she […]

Elections

2020 VietMX 0

You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in […]

Distributed Join

2020 VietMX 0

Piegirl was asked to implement two table join operation for distributed database system, minimizing the network traffic. Suppose she wants to join two tables, A and B. Each […]

No to Palindromes

2020 VietMX 30

Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn’t contain any palindrome contiguous substring of length […]

Bingo!

2020 VietMX 0

The game of bingo is played on a 5 × 5 square grid filled with distinct numbers between 1 and 75. In this problem you will consider a generalized version played on […]