
Road Repairs
A country named Berland has n cities. They are numbered with integers from 1 to n. City with index 1 is the capital of the country. Some pairs of cities have monodirectional […]
A country named Berland has n cities. They are numbered with integers from 1 to n. City with index 1 is the capital of the country. Some pairs of cities have monodirectional […]
Some days ago, I learned the concept of LCM (least common multiple). I’ve played with it for several times and I want to make a […]
You’re playing a game called Osu! Here’s a simplified version of it. There are n clicks in a game. For each click there are two outcomes: correct […]
There are n cities in the country where the Old Peykan lives. These cities are located on a straight line, we’ll denote them from left to right […]
Mirror Box is a name of a popular game in the Iranian National Amusement Park (INAP). There is a wooden box, 105 cm long and 100 cm high in […]
Martha — as a professional problemsetter — proposed a problem for a world-class contest. This is the problem statement: Tomorrow is Nadia’s birthday, and Bardia […]
A sequence of non-negative integers a 1, a 2, …, a n of length n is called a wool sequence if and only if there exists two integers l and r (1 ≤ l ≤ r ≤ n) such that . In other words each wool sequence contains a […]
You must have heard of the two brothers dreaming of ruling the world. With all their previous plans failed, this time they decided to cooperate […]
This problem is the most boring one you’ve ever seen. Given a sequence of integers a 1, a 2, …, a n and a non-negative integer h, our goal is to partition the sequence […]
Urpal lives in a big city. He has planned to meet his lover tonight. The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, […]
Polycarpus has a sequence, consisting of n non-negative integers: a 1, a 2, …, a n. Let’s define function f(l, r) ( l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all the sequence elements with indexes […]
Old MacDonald has a farm and a large potato field, (1010 + 1) × (1010 + 1) square meters in size. The field is divided into square garden beds, each bed takes up […]
Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he […]
Little Petya likes permutations a lot. Recently his mom has presented him permutation q 1, q 2, …, q n of length n. A permutation a of length n is a sequence of integers a 1, a 2, …, a n (1 ≤ a i ≤ n), all integers there are distinct. […]