
ACM


Berland Miners
The biggest gold mine in Berland consists of n caves, connected by n - 1 transitions. The entrance to the mine leads to the cave number 1, it is possible to go […]


Playing on Graph
Vova and Marina love offering puzzles to each other. Today Marina offered Vova to cope with the following task. Vova has a non-directed graph consisting […]

Place Your Ad Here
Ivan Anatolyevich’s agency is starting to become famous in the town. They have already ordered and made n TV commercial videos. Each video is made in a […]

Superhero’s Job
It’s tough to be a superhero. And it’s twice as tough to resist the supervillain who is cool at math. Suppose that you’re an ordinary […]

Idempotent functions
Some time ago Leonid have known about idempotent functions. Idempotent function defined on a set {1, 2, …, n} is such function , that for any the formula g(g(x)) = g(x) holds. Let’s denote as f (k)(x) the function f applied k times to the value x. […]

Face Detection
The developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunately, they are currently busy preparing a contest for […]

Degenerate Matrix
The determinant of a matrix 2 × 2 is defined as follows: A matrix is called degenerate if its determinant is equal to zero. The norm ||A|| of a matrix A is defined as a maximum of absolute […]

Happy Line
Do you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this summer day a large queue […]

The Game Of Parity
There are n cities in Westeros. The i-th city is inhabited by a i people. Daenerys and Stannis play the following game: in one single move, a player chooses a certain […]

Haar Features
The first algorithm for detecting a face on the image working in realtime was developed by Paul Viola and Michael Jones in 2001. A part […]

Looksery Party
The Looksery company, consisting of n staff members, is planning another big party. Every employee has his phone number and the phone numbers of his friends in […]

Yura and Developers
Yura has a team of k developers and a list of n tasks numbered from 1 to n. Yura is going to choose some tasks to be done this week. Due to […]

Pudding Monsters
In this problem you will meet the simplified model of game Pudding Monsters. An important process in developing any game is creating levels. A game […]

Clique in the Divisibility Graph
As you must know, the maximum clique problem in an arbitrary graph is NP-hard. Nevertheless, for some graphs of specific kinds it can be solved effectively. […]

Restructuring Company
Even the most successful company can go through a crisis period when you have to make a hard decision — to restructure, discard and merge […]

Max and Min
Two kittens, Max and Min, play with a pair of non-negative integers x and y. As you can guess from their names, kitten Max loves to maximize and […]

Replicating Processes
A Large Software Company develops its own social network. Analysts have found that during the holidays, major sporting events and other significant events users begin […]

Restoring Map
Archaeologists found some information about an ancient land of Treeland. We know for sure that the Treeland consisted of n cities connected by the n - 1 road, such that you […]