Problem ID
stringlengths
2
6
Problem Description
stringlengths
0
7.52k
Rating
float64
800
3.5k
math
bool
2 classes
greedy
bool
2 classes
implementation
bool
2 classes
dp
bool
2 classes
data structures
bool
2 classes
constructive algorithms
bool
2 classes
brute force
bool
2 classes
binary search
bool
2 classes
sortings
bool
2 classes
graphs
bool
2 classes
__index_level_0__
int64
3
9.98k
1762F
You are given an array $$$a$$$ consisting of $$$n$$$ integers and an integer $$$k$$$. A pair $$$(l,r)$$$ is good if there exists a sequence of indices $$$i_1, i_2, dots, i_m$$$ such that $$$i_1=l$$$ and $$$i_m=r$$$; $$$i_j < i_{j+1}$$$ for all $$$1 leq j < m$$$; and $$$a_{i_j}-a_{i_{j+1}} leq k$$$ for all $$$1 leq j...
2,600
false
false
false
true
true
false
false
true
false
false
1,735
166A
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place. You know the rules of comparing the results of two given...
1,100
false
false
true
false
false
false
false
true
true
false
9,200
1263D
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords — strings, consists of small Latin letters. Hacker went home and started prepari...
1,500
false
false
false
false
false
false
false
false
false
true
4,384
1476C
You have $$$n$$$ chains, the $$$i$$$-th chain consists of $$$c_i$$$ vertices. Vertices in each chain are numbered independently from $$$1$$$ to $$$c_i$$$ along the chain. In other words, the $$$i$$$-th chain is the undirected graph with $$$c_i$$$ vertices and $$$(c_i - 1)$$$ edges connecting the $$$j$$$-th and the $$$(...
1,600
false
true
false
true
false
false
false
false
false
true
3,295
700D
Alice wants to send an important message to Bob. Message _a_u2009=u2009(_a_1,u2009...,u2009_a__n_) is a sequence of positive integers (characters). To compress the message Alice wants to use binary Huffman coding. We recall that binary Huffman code, or binary prefix code is a function _f_, that maps each letter that ap...
3,100
false
true
false
false
true
false
false
false
false
false
7,022
1772B
You have a matrix $$$2 imes 2$$$ filled with distinct integers. You want your matrix to become beautiful. The matrix is beautiful if the following two conditions are satisfied: in each row, the first element is smaller than the second element; in each column, the first element is smaller than the second element. You...
800
false
false
true
false
false
false
true
false
false
false
1,662
404B
Valera takes part in the Berland Marathon. The marathon race starts at the stadium that can be represented on the plane as a square whose lower left corner is located at point with coordinates (0,u20090) and the length of the side equals _a_ meters. The sides of the square are parallel to coordinate axes. As the length...
1,500
true
false
true
false
false
false
false
false
false
false
8,209
578E
There is a sand trail in front of Alice's home. In daytime, people walk over it and leave a footprint on the trail for their every single step. Alice cannot distinguish the order of the footprints, but she can tell whether each footprint is made by left foot or right foot. Also she's certain that all people are walking...
2,700
false
true
false
false
false
true
false
false
false
false
7,532
1699C
You are given a permutation $$$a_1,a_2,ldots,a_n$$$ of integers from $$$0$$$ to $$$n - 1$$$. Your task is to find how many permutations $$$b_1,b_2,ldots,b_n$$$ are similar to permutation $$$a$$$. Two permutations $$$a$$$ and $$$b$$$ of size $$$n$$$ are considered similar if for all intervals $$$[l,r]$$$ ($$$1 le l le r...
1,700
true
false
false
false
false
true
false
false
false
false
2,085
1715F
This is an interactive problem. Farmer Stanley grows corn on a rectangular field of size $$$ n imes m $$$ meters with corners in points $$$(0, 0)$$$, $$$(0, m)$$$, $$$(n, 0)$$$, $$$(n, m)$$$. This year the harvest was plentiful and corn covered the whole field. The night before harvest aliens arrived and poisoned the ...
2,700
true
false
false
false
false
true
false
false
false
false
1,988
1973B
Today, Cat and Fox found an array $$$a$$$ consisting of $$$n$$$ non-negative integers. Define the loneliness of $$$a$$$ as the smallest positive integer $$$k$$$ ($$$1 le k le n$$$) such that for any two positive integers $$$i$$$ and $$$j$$$ ($$$1 leq i, j leq n - k +1$$$), the following holds: $$$$$$a_i a_{i+1} ldots...
1,300
true
true
false
false
true
false
false
true
false
false
454
414D
Mashmokh is playing a new game. In the beginning he has _k_ liters of water and _p_ coins. Additionally he has a rooted tree (an undirected connected acyclic graph) that consists of _m_ vertices. Each vertex of the tree contains a water tank that is empty in the beginning. The game begins with the fact that Mashmokh ch...
2,300
false
true
false
false
true
false
false
true
false
false
8,166
1425H
Chaneka has a hobby of playing with animal toys. Every toy has a different fun value, a real number. Chaneka has four boxes to store the toys with specification: The first box stores toys with fun values in range of $$$(-infty,-1]$$$. The second box stores toys with fun values in range of $$$(-1, 0)$$$. The third bo...
1,300
false
false
false
false
false
true
false
false
false
false
3,541
371D
There is a system of _n_ vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to _n_, in the order from the highest to the lowest, the volume of the _i_-th vessel is _a__i_ liters. Initially, all the vessels are empty. In some vessels water is poured. All the wa...
1,800
false
false
true
false
true
false
false
false
false
false
8,345
360C
Levko loves strings of length _n_, consisting of lowercase English letters, very much. He has one such string _s_. For each string _t_ of length _n_, Levko defines its beauty relative to _s_ as the number of pairs of indexes _i_, _j_ (1u2009≤u2009_i_u2009≤u2009_j_u2009≤u2009_n_), such that substring _t_[_i_.._j_] is le...
2,500
false
false
false
true
false
false
false
false
false
false
8,392
1637G
Vitaly gave Maxim $$$n$$$ numbers $$$1, 2, ldots, n$$$ for his $$$16$$$-th birthday. Maxim was tired of playing board games during the celebration, so he decided to play with these numbers. In one step Maxim can choose two numbers $$$x$$$ and $$$y$$$ from the numbers he has, throw them away, and add two numbers $$$x + ...
3,000
true
true
false
false
false
true
false
false
false
false
2,428
1195D1
This problem differs from the next one only in the presence of the constraint on the equal length of all numbers $$$a_1, a_2, dots, a_n$$$. Actually, this problem is a subtask of the problem D2 from the same contest and the solution of D2 solves this subtask too. A team of SIS students is going to make a trip on a subm...
1,500
true
false
false
false
false
false
false
false
false
false
4,726
140F
As Gerald ..., in other words, on a New Year Eve Constantine prepared an unusual present for the Beautiful Lady. The present is the magic New Year snowflake that can make any dream come true. The New Year snowflake consists of tiny ice crystals, which can be approximately regarded as points on the plane. The beauty of ...
2,600
false
false
false
false
false
false
false
false
true
false
9,313
995F
Allen, having graduated from the MOO Institute of Techcowlogy (MIT), has started a startup! Allen is the president of his startup. He also hires $$$n-1$$$ other employees, each of which is assigned a direct superior. If $$$u$$$ is a superior of $$$v$$$ and $$$v$$$ is a superior of $$$w$$$ then also $$$u$$$ is a superio...
2,700
true
false
false
true
false
false
false
false
false
false
5,721
1983B
You are given two grids of numbers $$$a$$$ and $$$b$$$, with $$$n$$$ rows and $$$m$$$ columns. All the values in the grid are $$$0$$$, $$$1$$$ or $$$2$$$. You can perform the following operation on $$$a$$$ any number of times: Pick any subrectangle in the grid with length and width $$$ge 2$$$. You are allowed to choos...
1,200
true
true
true
false
false
true
false
false
false
false
389
576B
A tree of size _n_ is an undirected connected graph consisting of _n_ vertices without cycles. Consider some tree with _n_ vertices. We call a tree invariant relative to permutation _p_u2009=u2009_p_1_p_2... _p__n_, if for any two vertices of the tree _u_ and _v_ the condition holds: "vertices _u_ and _v_ are connected...
2,100
false
true
false
false
false
true
false
false
false
false
7,542
1578L
In a dream, Lucy found herself in a labyrinth. This labyrinth consists of $$$n$$$ rooms, connected by $$$m$$$ passages ($$$i$$$-th passage is $$$w_i$$$ cm wide). Each passage can be traversed in both directions. It is guaranteed that it is possible to get from any room to any other room. But this is not an ordinary lab...
2,400
false
true
false
false
false
false
false
true
false
false
2,743
231A
One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution....
800
false
true
false
false
false
false
true
false
false
false
8,916
155B
Ilya plays a card game by the following rules. A player has several cards. Each card contains two non-negative integers inscribed, one at the top of the card and one at the bottom. At the beginning of the round the player chooses one of his cards to play it. If the top of the card contains number _a__i_, and the bottom...
1,100
false
true
false
false
false
false
false
false
true
false
9,253
1529B
A sequence $$$(b_1, b_2, ldots, b_k)$$$ is called strange, if the absolute difference between any pair of its elements is greater than or equal to the maximum element in the sequence. Formally speaking, it's strange if for every pair $$$(i, j)$$$ with $$$1 le i<j le k$$$, we have $$$a_i-a_jgeq MAX$$$, where $$$MAX$$$ i...
1,100
true
true
false
false
false
false
false
false
true
false
3,016
1428A
Wabbit is trying to move a box containing food for the rest of the zoo in the coordinate plane from the point $$$(x_1,y_1)$$$ to the point $$$(x_2,y_2)$$$. He has a rope, which he can use to pull the box. He can only pull the box if he stands exactly $$$1$$$ unit away from the box in the direction of one of two coordin...
800
true
false
false
false
false
false
false
false
false
false
3,525
1733E
There is a conveyor with $$$120$$$ rows and $$$120$$$ columns. Each row and column is numbered from $$$0$$$ to $$$119$$$, and the cell in $$$i$$$-th row and $$$j$$$-th column is denoted as $$$(i, j)$$$. The top leftmost cell is $$$(0, 0)$$$. Each cell has a belt, and all belts are initially facing to the right. Initial...
2,700
true
false
false
true
false
true
false
false
false
false
1,887
718D
During the chemistry lesson Andrew learned that the saturated hydrocarbons (alkanes) enter into radical chlorination reaction. Andrew is a very curious boy, so he wondered how many different products of the reaction may be forms for a given alkane. He managed to solve the task for small molecules, but for large ones he...
2,900
false
false
false
true
false
false
false
false
false
false
6,941
1393E2
This is a harder version of the problem E with larger constraints. Twilight Sparkle has received a new task from Princess Celestia. This time she asked to decipher the ancient scroll containing important knowledge of pony origin. To hide the crucial information from evil eyes, pony elders cast a spell on the scroll. Th...
3,200
false
false
true
true
false
false
false
false
false
false
3,702
461D
Toastman came up with a very complicated task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him? Given a _n_u2009×u2009_n_ checkerboard. Each cell of the board has either character 'x', or character 'o', or nothing. How many ways to fill all the empty cells with 'x' or 'o' (each cell...
2,800
true
false
false
false
false
false
false
false
false
false
7,993
691B
Problem - 691B - Codeforces =============== xa0 which consists of only English letters. Output Print "TAK" if the string _s_ is "s-palindrome" and "NIE" otherwise. Examples Input oXoxoXo Output TAK Input bod Output TAK Input ER Output NIE
1,600
false
false
true
false
false
false
false
false
false
false
7,046
1057B
We get more and more news about DDoS-attacks of popular websites. Arseny is an admin and he thinks that a website is under a DDoS-attack if the total number of requests for a some period of time exceeds $$$100 cdot t$$$, where $$$t$$$ — the number of seconds in this time segment. Arseny knows statistics on the number o...
1,400
false
false
false
false
false
false
true
false
false
false
5,423
939B
Dima has a hamsters farm. Soon _N_ hamsters will grow up on it and Dima will sell them in a city nearby. Hamsters should be transported in boxes. If some box is not completely full, the hamsters in it are bored, that's why each box should be completely full with hamsters. Dima can buy boxes at a factory. The factory pr...
1,000
false
false
true
false
false
false
false
false
false
false
5,943
1511D
Problem - 1511D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,600
false
true
false
false
false
true
true
false
false
true
3,113
1312G
You are given a set of strings $$$S$$$. Each string consists of lowercase Latin letters. For each string in this set, you want to calculate the minimum number of seconds required to type this string. To type a string, you have to start with an empty string and transform it into the string you want to type using the fol...
2,600
false
false
false
true
true
false
false
false
false
false
4,131
376A
You have a description of a lever as string _s_. We'll represent the string length as record _s_, then the lever looks as a horizontal bar with weights of length _s_u2009-u20091 with exactly one pivot. We will assume that the bar is a segment on the _Ox_ axis between points 0 and _s_u2009-u20091. The decoding of the le...
900
true
false
true
false
false
false
false
false
false
false
8,326
56E
Problem - 56E - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so...
2,200
false
false
false
false
true
false
false
true
true
false
9,691
482B
Problem - 482B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,800
false
false
false
false
true
true
false
false
false
false
7,908
1494A
You are given a string $$$a$$$, consisting of $$$n$$$ characters, $$$n$$$ is even. For each $$$i$$$ from $$$1$$$ to $$$n$$$ $$$a_i$$$ is one of 'A', 'B' or 'C'. A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence is a bracket sequence that can be transformed into a correct ...
900
false
false
true
false
false
false
true
false
false
false
3,202
1280A
We start with a string $$$s$$$ consisting only of the digits $$$1$$$, $$$2$$$, or $$$3$$$. The length of $$$s$$$ is denoted by $$$s$$$. For each $$$i$$$ from $$$1$$$ to $$$s$$$, the $$$i$$$-th character of $$$s$$$ is denoted by $$$s_i$$$. There is one cursor. The cursor's location $$$ell$$$ is denoted by an integer in ...
1,700
true
false
true
false
false
false
false
false
false
false
4,294
1017F
Notice: unusual memory limit! After the war, destroyed cities in the neutral zone were restored. And children went back to school. The war changed the world, as well as education. In those hard days, a new math concept was created. As we all know, logarithm function can be described as: $$$$$$ log(p_1^{a_1}p_2^{a_2}......
2,500
true
false
false
false
false
false
true
false
false
false
5,600
975A
In Aramic language words can only represent objects. Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
900
false
false
true
false
false
false
false
false
false
false
5,835
1774G
ChthollyNotaSeniorious gives DataStructures a number axis with $$$m$$$ distinct segments on it. Let $$$f(l,r)$$$ be the number of ways to choose an even number of segments such that the union of them is exactly $$$[l,r]$$$, and $$$g(l,r)$$$ be the number of ways to choose an odd number of segments such that the union o...
3,200
false
false
false
true
true
true
true
false
false
false
1,637
912D
While Grisha was celebrating New Year with Ded Moroz, Misha gifted Sasha a small rectangular pond of size _n_u2009×u2009_m_, divided into cells of size 1u2009×u20091, inhabited by tiny evil fishes (no more than one fish per cell, otherwise they'll strife!). The gift bundle also includes a square scoop of size _r_u2009×...
2,100
false
true
false
false
true
false
false
false
false
true
6,093
1989E
Problem - 1989E - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
2,300
true
false
false
true
false
false
false
false
false
false
337
1690F
Polycarp found the string $$$s$$$ and the permutation $$$p$$$. Their lengths turned out to be the same and equal to $$$n$$$. A permutation of $$$n$$$ elementsxa0— is an array of length $$$n$$$, in which every integer from $$$1$$$ to $$$n$$$ occurs exactly once. For example, $$$[1, 2, 3]$$$ and $$$[4, 3, 5, 1, 2]$$$ are...
1,700
true
false
false
false
false
false
false
false
false
true
2,138
1868B1
This is the easy version of the problem. The only difference is that in this version everyone must give candies to exactly one person and receive candies from exactly one person. Note that a submission cannot pass both versions of the problem at the same time. You can make hacks only if both versions of the problem are...
1,700
true
true
true
false
false
true
false
false
false
true
1,067
803B
Problem - 803B - Codeforces =============== xa0 . There is at least one zero element in the given array. Input The first line contains integer _n_ (1u2009≤u2009_n_u2009≤u20092·105) — length of the array _a_. The second line contains integer elements of the array separated by single spaces (u2009-u2009109u...
1,200
false
false
false
false
false
true
false
false
false
false
6,551
160A
Imagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then you very well know what it's like. Now let's imagine a typical morning in your family. You haven't wo...
900
false
true
false
false
false
false
false
false
true
false
9,235
768A
Night gathers, and now my watch begins. It shall not end until my death. I shall take no wife, hold no lands, father no children. I shall wear no crowns and win no glory. I shall live and die at my post. I am the sword in the darkness. I am the watcher on the walls. I am the shield that guards the realms of men. I pled...
900
false
false
false
false
false
true
false
false
true
false
6,713
367E
Sereja is interested in intervals of numbers, so he has prepared a problem about intervals for you. An interval of numbers is a pair of integers [_l_,u2009_r_] (1u2009≤u2009_l_u2009≤u2009_r_u2009≤u2009_m_). Interval [_l_1,u2009_r_1] belongs to interval [_l_2,u2009_r_2] if the following condition is met: _l_2u2009≤u2009...
2,700
false
false
false
true
false
false
false
false
false
false
8,361
16B
Problem - 16B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so...
900
false
true
true
false
false
false
false
false
true
false
9,914
1661B
Problem - 1661B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,300
false
true
false
true
false
false
true
false
false
true
2,318
2026C
There is a shop that sells action figures near Monocarp's house. A new set of action figures will be released shortly; this set contains $$$n$$$ figures, the $$$i$$$-th figure costs $$$i$$$ coins and is available for purchase from day $$$i$$$ to day $$$n$$$. For each of the $$$n$$$ days, Monocarp knows whether he can v...
1,500
false
true
true
false
true
true
true
true
false
false
114
493E
Problem - 493E - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,800
true
false
false
false
false
false
false
false
false
false
7,859
277B
Problem - 277B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,300
false
false
false
false
false
true
false
false
false
false
8,726
1854D
Michael and Brian are stuck in a hotel with $$$n$$$ rooms, numbered from $$$1$$$ to $$$n$$$, and need to find each other. But this hotel's doors are all locked and the only way of getting around is by using the teleporters in each room. Room $$$i$$$ has a teleporter that will take you to room $$$a_i$$$ (it might be tha...
3,000
false
false
false
false
false
false
false
true
false
false
1,155
1654C
Alice has a cake, and she is going to cut it. She will perform the following operation $$$n-1$$$ times: choose a piece of the cake (initially, the cake is all one piece) with weight $$$wge 2$$$ and cut it into two smaller pieces of weight $$$lfloorfrac{w}{2} floor$$$ and $$$lceilfrac{w}{2} ceil$$$ ($$$lfloor x floor$$...
1,400
false
true
true
false
true
false
false
false
true
false
2,360
1316E
Alice, the president of club FCB, wants to build a team for the new volleyball tournament. The team should consist of $$$p$$$ players playing in $$$p$$$ different positions. She also recognizes the importance of audience support, so she wants to select $$$k$$$ people as part of the audience. There are $$$n$$$ people in...
2,300
false
true
false
true
false
false
false
false
true
false
4,117
193B
John Doe has four arrays: _a_, _b_, _k_, and _p_. Each array consists of _n_ integers. Elements of all arrays are indexed starting from 1. Array _p_ is a permutation of integers 1 to _n_. John invented a game for his friends and himself. Initially a player is given array _a_. The player must consecutively execute exact...
2,000
false
false
false
false
false
false
true
false
false
false
9,069
1553D
You are given two strings $$$s$$$ and $$$t$$$, both consisting of lowercase English letters. You are going to type the string $$$s$$$ character by character, from the first character to the last one. When typing a character, instead of pressing the button corresponding to it, you can press the "Backspace" button. It de...
1,500
false
true
false
true
false
false
false
false
false
false
2,872
914D
Bash likes playing with arrays. He has an array _a_1,u2009_a_2,u2009... _a__n_ of _n_ integers. He likes to guess the greatest common divisor (gcd) of different segments of the array. Of course, sometimes the guess is not correct. However, Bash will be satisfied if his guess is almost correct. Suppose he guesses that t...
1,900
false
false
false
false
true
false
false
false
false
false
6,080
220D
Problem - 220D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,500
true
false
false
false
false
false
false
false
false
false
8,956
1841E
There is a square matrix, consisting of $$$n$$$ rows and $$$n$$$ columns of cells, both numbered from $$$1$$$ to $$$n$$$. The cells are colored white or black. Cells from $$$1$$$ to $$$a_i$$$ are black, and cells from $$$a_i+1$$$ to $$$n$$$ are white, in the $$$i$$$-th column. You want to place $$$m$$$ integers in the ...
2,200
true
true
false
false
true
false
false
false
false
false
1,241
767B
Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before it actually opens. Vasya wants to visit the passport office tomorrow. He knows...
2,100
false
true
false
false
false
false
true
false
false
false
6,717
1790A
On March 14, the day of the number $$$pi$$$ is celebrated all over the world. This is a very important mathematical constant equal to the ratio of the circumference of a circle to its diameter. Polycarp was told at school that the number $$$pi$$$ is irrational, therefore it has an infinite number of digits in decimal n...
800
true
false
true
false
false
false
false
false
false
false
1,542
379C
Problem - 379C - Codeforces =============== xa0 has come up with a New Year adventure. Specifically, they decided to give ratings to all visitors. There are _n_ users on the site, for each user we know the rating value he wants to get as a New Year Present. We know that user _i_ wants to get at least _a__...
1,400
false
true
false
false
false
false
false
false
true
false
8,315
653G
Pussycat Sonya has an array consisting of _n_ positive integers. There are 2_n_ possible subsequences of the array. For each subsequence she counts the minimum number of operations to make all its elements equal. Each operation must be one of two: Choose some element of the subsequence and multiply it by some prime nu...
3,100
true
false
false
false
false
false
false
false
false
false
7,198
660A
Problem - 660A - Codeforces =============== xa0 ]( "Educational Codeforces Round 11") — the number of elements in the given array. The second line contains _n_ integers _a__i_ (1u2009≤u2009_a__i_u2009≤u2009109) — the elements of the array _a_. Output Print integer _k_ on the first line — the least number o...
1,200
true
true
true
false
false
false
false
false
false
false
7,182
68A
Little Petya was given this problem for homework: You are given function (here represents the operation of taking the remainder). His task is to count the number of integers _x_ in range [_a_;_b_] with property _f_(_x_)u2009=u2009_x_. It is a pity that Petya forgot the order in which the remainders should be taken and ...
1,100
false
false
true
false
false
false
false
false
false
false
9,631
1081A
Chouti was doing a competitive programming competition. However, after having all the problems accepted, he got bored and decided to invent some small games. He came up with the following game. The player has a positive integer $$$n$$$. Initially the value of $$$n$$$ equals to $$$v$$$ and the player is able to do the f...
800
true
false
false
false
false
true
false
false
false
false
5,323
323C
You are given two permutations _p_ and _q_, consisting of _n_ elements, and _m_ queries of the form: _l_1,u2009_r_1,u2009_l_2,u2009_r_2 (_l_1u2009≤u2009_r_1;xa0_l_2u2009≤u2009_r_2). The response for the query is the number of such integers from 1 to _n_, that their position in the first permutation is in segment [_l_1,...
2,400
false
false
false
false
true
false
false
false
false
false
8,542
649C
Statement is not available on English language На тренировку по подготовке к соревнованиям по программированию пришли _n_ команд. Тренер для каждой команды подобрал тренировку, комплект задач для _i_-й команды занимает _a__i_ страниц. В распоряжении тренера есть _x_ листов бумаги, у которых обе стороны чистые, и _y_ ли...
1,500
false
true
false
false
false
true
false
false
true
false
7,220
1342B
Let's say string $$$s$$$ has period $$$k$$$ if $$$s_i = s_{i + k}$$$ for all $$$i$$$ from $$$1$$$ to $$$s - k$$$ ($$$s$$$ means length of string $$$s$$$) and $$$k$$$ is the minimum positive integer with this property. Some examples of a period: for $$$s$$$="0101" the period is $$$k=2$$$, for $$$s$$$="0000" the period i...
1,100
false
false
false
false
false
true
false
false
false
false
3,998
1025E
Vasya passes all exams! Despite expectations, Vasya is not tired, moreover, he is ready for new challenges. However, he does not want to work too hard on difficult problems. Vasya remembered that he has a not-so-hard puzzle: $$$m$$$ colored cubes are placed on a chessboard of size $$$n imes n$$$. The fact is that $$$m...
2,700
false
false
true
false
false
true
false
false
false
false
5,579
234F
Vasya should paint a fence in front of his own cottage. The fence is a sequence of _n_ wooden boards arranged in a single row. Each board is a 1 centimeter wide rectangle. Let's number the board fence using numbers 1,u20092,u2009...,u2009_n_ from left to right. The height of the _i_-th board is _h__i_ centimeters. Vasy...
1,800
false
false
false
true
false
false
false
false
false
false
8,899
1296C
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'. Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
1,500
false
false
true
false
true
false
false
false
false
false
4,215
226D
Problem - 226D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,100
false
true
false
false
false
true
false
false
false
false
8,932
1007A
You are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that as many as possible integers will become on a place where a smaller integer used to stand. Help Vasya find the maximal number of such integers. For instance, if we are given an array $$$[10, 20, 30, 40]$$$, we c...
1,300
true
false
false
false
true
false
false
false
true
false
5,649
1777F
You are given an array $$$a$$$ consisting of $$$n$$$ non-negative integers. The numbness of a subarray $$$a_l, a_{l+1}, ldots, a_r$$$ (for arbitrary $$$l leq r$$$) is defined as $$$$$$max(a_l, a_{l+1}, ldots, a_r) oplus (a_l oplus a_{l+1} oplus ldots oplus a_r),$$$$$$ where $$$oplus$$$ denotes the . The description of ...
2,400
false
false
false
false
true
false
false
false
false
false
1,609
1630F
You are given an undirected graph of $$$n$$$ vertices indexed from $$$1$$$ to $$$n$$$, where vertex $$$i$$$ has a value $$$a_i$$$ assigned to it and all values $$$a_i$$$ are different. There is an edge between two vertices $$$u$$$ and $$$v$$$ if either $$$a_u$$$ divides $$$a_v$$$ or $$$a_v$$$ divides $$$a_u$$$. Find th...
3,400
false
false
false
false
false
false
false
false
false
true
2,461
188E
Problem - 188E - Codeforces =============== xa0 , "9" prints the lyrics of "99 Bottles of Beer" song, "+" increments the value stored in the internal accumulator. Instructions "H" and "Q" are case-sensitive and must be uppercase. The characters of the program which are not instructions are ignored. You ...
1,400
false
false
true
false
false
false
false
false
false
false
9,088
1789F
Serval loves Brain Power and his brain power problem. Serval defines that a string $$$T$$$ is powerful iff $$$T$$$ can be obtained by concatenating some string $$$T'$$$ multiple times. Formally speaking, $$$T$$$ is powerful iff there exist a string $$$T'$$$ and an integer $$$kgeq 2$$$ such that $$$$$$T=underbrace{T'+T'...
2,700
false
true
true
true
false
false
true
false
false
false
1,543
1692D
Victor has a . He looks at the clock every $$$x$$$ minutes, and the clock is currently showing time $$$s$$$. How many different palindromes will Victor see in total after looking at the clock every $$$x$$$ minutes, the first time being at time $$$s$$$? For example, if the clock starts out as 03:12 and Victor looks at t...
1,100
false
false
true
false
false
false
true
false
false
false
2,127
618B
Bob has a permutation of integers from 1 to _n_. Denote this permutation as _p_. The _i_-th element of _p_ will be denoted as _p__i_. For all pairs of distinct integers _i_,u2009_j_ between 1 and _n_, he wrote the number _a__i_,u2009_j_u2009=u2009_min_(_p__i_,u2009_p__j_). He writes _a__i_,u2009_i_u2009=u20090 for all ...
1,100
false
false
false
false
false
true
false
false
false
false
7,363
1051B
Problem - 1051B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,000
true
true
false
false
false
false
false
false
false
false
5,454
1237B
Consider a tunnel on a one-way road. During a particular day, $$$n$$$ cars numbered from $$$1$$$ to $$$n$$$ entered and exited the tunnel exactly once. All the cars passed through the tunnel at constant speeds. A traffic enforcement camera is mounted at the tunnel entrance. Another traffic enforcement camera is mounted...
1,300
false
false
false
false
true
false
false
false
true
false
4,511
1157A
Problem - 1157A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,100
false
false
true
false
false
false
false
false
false
false
4,923
1901A
There is a road, which can be represented as a number line. You are located in the point $$$0$$$ of the number line, and you want to travel from the point $$$0$$$ to the point $$$x$$$, and back to the point $$$0$$$. You travel by car, which spends $$$1$$$ liter of gasoline per $$$1$$$ unit of distance travelled. When y...
800
true
true
false
false
false
false
false
false
false
false
909
19B
Problem - 19B - Codeforces =============== xa0 . In each of the following _n_ lines each item is described by a pair of numbers _t__i_, _c__i_ (0u2009≤u2009_t__i_u2009≤u20092000,u20091u2009≤u2009_c__i_u2009≤u2009109). If _t__i_ is 0, Bob won't be able to steal anything, while the checkout assistant is occ...
1,900
false
false
false
true
false
false
false
false
false
false
9,899
1620F
You are given a permutation $$$p$$$ consisting of $$$n$$$ integers $$$1, 2, dots, n$$$ (a permutation is an array where each element from $$$1$$$ to $$$n$$$ occurs exactly once). Let's call an array $$$a$$$ bipartite if the following undirected graph is bipartite: the graph consists of $$$n$$$ vertices; two vertices ...
2,800
false
true
false
true
false
false
false
false
false
false
2,522
891C
For a connected undirected weighted graph _G_, MST (minimum spanning tree) is a subgraph of _G_ that contains all of _G_'s vertices, is a tree, and sum of its edges is minimum possible. You are given a graph _G_. If you run a MST algorithm on graph it would give you only one MST and it causes other edges to become jeal...
2,300
false
false
false
false
true
false
false
false
false
true
6,186
1495F
There are $$$n$$$ squares drawn from left to right on the floor. The $$$i$$$-th square has three integers $$$p_i,a_i,b_i$$$, written on it. The sequence $$$p_1,p_2,dots,p_n$$$ forms a permutation. Each round you will start from the leftmost square $$$1$$$ and jump to the right. If you are now on the $$$i$$$-th square, ...
3,300
false
false
false
true
true
true
false
false
false
true
3,191
144D
A country called Berland consists of _n_ cities, numbered with integer numbers from 1 to _n_. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by these roads. According to some Super Duper Documents, Berland is protected by the Super Duper Mis...
1,900
false
false
false
false
true
false
false
false
false
true
9,297
1405B
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + cdots + a_n = 0$$$. In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 le i, j le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one coin...
1,000
false
false
true
false
false
true
false
false
false
false
3,647
359C
Problem - 359C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,900
true
false
false
false
false
false
false
false
false
false
8,397
412E
One of the most important products of the R1 company is a popular @r1.com mail service. The R1 mailboxes receive and send millions of emails every day. Today, the online news thundered with terrible information. The R1 database crashed and almost no data could be saved except for one big string. The developers assume t...
1,900
false
false
true
false
false
false
false
false
false
false
8,175
1970G2
In the medium version, $$$2 leq sum n leq 300$$$ and $$$1 leq sum m leq 300$$$ After a worker's strike organized by the Dementors asking for equal rights, the prison of Azkaban has suffered some damage. After settling the spirits, the Ministry of Magic is looking to renovate the prison to ensure that the Dementors are ...
2,200
false
false
false
true
false
false
true
false
false
true
467
685D
Snow Queen told Kay to form a word "eternity" using pieces of ice. Kay is eager to deal with the task, because he will then become free, and Snow Queen will give him all the world and a pair of skates. Behind the palace of the Snow Queen there is an infinite field consisting of cells. There are _n_ pieces of ice spread...
2,600
false
false
true
false
false
false
true
false
true
false
7,080
1744A
An integer array $$$a_1, a_2, ldots, a_n$$$ is being transformed into an array of lowercase English letters using the following prodecure: While there is at least one number in the array: Choose any number $$$x$$$ from the array $$$a$$$, and any letter of the English alphabet $$$y$$$. Replace all occurrences of numbe...
800
false
true
true
false
false
false
false
false
false
false
1,817