
Borya and Hanabi
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, […]
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 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 […]
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 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 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 […]
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. […]
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 […]
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. […]
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 […]
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 […]
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 loves fun. However, everyone has fun in the unique manner. Serega has fun by solving query problems. One day Fedor came up with such […]
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 […]
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 […]
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 […]