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
413E
The last product of the R2 company in the 2D games' field is a new revolutionary algorithm of searching for the shortest path in a 2u2009×u2009_n_ maze. Imagine a maze that looks like a 2u2009×u2009_n_ rectangle, divided into unit squares. Each unit square is either an empty cell or an obstacle. In one unit of time, a ...
2,200
false
false
false
false
true
false
false
false
false
false
8,170
449B
Jzzhu is the president of country A. There are _n_ cities numbered from 1 to _n_ in his country. City 1 is the capital of A. Also there are _m_ roads connecting the cities. One can go from city _u__i_ to _v__i_ (and vise versa) using the _i_-th road, the length of this road is _x__i_. Finally, there are _k_ train route...
2,000
false
true
false
false
false
false
false
false
false
true
8,043
1630B
Given an array $$$a$$$ of $$$n$$$ integers, find a range of values $$$[x, y]$$$ ($$$x le y$$$), and split $$$a$$$ into exactly $$$k$$$ ($$$1 le k le n$$$) subarrays in such a way that: Each subarray is formed by several continuous elements of $$$a$$$, that is, it is equal to $$$a_l, a_{l+1}, ldots, a_r$$$ for some $$$...
1,800
false
true
false
false
true
true
false
true
false
false
2,465
1151C
Nazar, a student of the scientific lyceum of the Kingdom of Kremland, is known for his outstanding mathematical abilities. Today a math teacher gave him a very difficult task. Consider two infinite sets of numbers. The first set consists of odd positive numbers ($$$1, 3, 5, 7, ldots$$$), and the second set consists of ...
1,800
true
false
false
false
false
true
false
false
false
false
4,960
1777E
You will be given a weighted directed graph of $$$n$$$ nodes and $$$m$$$ directed edges, where the $$$i$$$-th edge has a weight of $$$w_i$$$ ($$$1 le i le m$$$). You need to reverse some edges of this graph so that there is at least one node in the graph from which every other node is reachable. The cost of these rever...
2,200
false
false
false
false
false
false
false
true
false
true
1,610
2004B
There are $$$100$$$ rooms arranged in a row and $$$99$$$ doors between them; the $$$i$$$-th door connects rooms $$$i$$$ and $$$i+1$$$. Each door can be either locked or unlocked. Initially, all doors are unlocked. We say that room $$$x$$$ is reachable from room $$$y$$$ if all doors between them are unlocked. You know t...
1,000
false
true
false
false
false
false
true
false
false
false
230
215B
The World Programming Olympics Medal is a metal disk, consisting of two parts: the first part is a ring with outer radius of _r_1 cm, inner radius of _r_2 cm, (0u2009<u2009_r_2u2009<u2009_r_1) made of metal with density _p_1 g/cm3. The second part is an inner disk with radius _r_2 cm, it is made of metal with density _...
1,300
true
true
false
false
false
false
false
false
false
false
8,980
1644D
There is a sheet of paper that can be represented with a grid of size $$$n imes m$$$: $$$n$$$ rows and $$$m$$$ columns of cells. All cells are colored in white initially. $$$q$$$ operations have been applied to the sheet. The $$$i$$$-th of them can be described as follows: $$$x_i$$$ $$$y_i$$$xa0— choose one of $$$k$$...
1,700
true
false
true
false
true
false
false
false
false
false
2,398
1428E
There are some rabbits in Singapore Zoo. To feed them, Zookeeper bought $$$n$$$ carrots with lengths $$$a_1, a_2, a_3, ldots, a_n$$$. However, rabbits are very fertile and multiply very quickly. Zookeeper now has $$$k$$$ rabbits and does not have enough carrots to feed all of them. To solve this problem, Zookeeper deci...
2,200
true
true
false
false
true
false
false
true
true
false
3,521
593E
Gosha's universe is a table consisting of _n_ rows and _m_ columns. Both the rows and columns are numbered with consecutive integers starting with 1. We will use (_r_,u2009_c_) to denote a cell located in the row _r_ and column _c_. Gosha is often invited somewhere. Every time he gets an invitation, he first calculates...
2,400
false
false
false
true
false
false
false
false
false
false
7,473
909F
Problem - 909F - 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
false
false
false
false
false
true
false
false
false
false
6,107
1889C1
The only differences between the two versions of this problem are the constraint on $$$k$$$, the time limit and the memory limit. You can make hacks only if all versions of the problem are solved. Doremy lives in a rainy country consisting of $$$n$$$ cities numbered from $$$1$$$ to $$$n$$$. The weather broadcast predic...
2,000
false
true
false
true
true
false
true
false
true
false
964
1495C
There are many sunflowers in the Garden of the Sun. Garden of the Sun is a rectangular table with $$$n$$$ rows and $$$m$$$ columns, where the cells of the table are farmlands. All of the cells grow a sunflower on it. Unfortunately, one night, the lightning stroke some (possibly zero) cells, and sunflowers on those cell...
2,300
false
false
false
false
false
true
false
false
false
true
3,194
1721E
You are given a string $$$s$$$, consisting of lowercase Latin letters. You are asked $$$q$$$ queries about it: given another string $$$t$$$, consisting of lowercase Latin letters, perform the following steps: 1. concatenate $$$s$$$ and $$$t$$$; 2. calculate the prefix function of the resulting string $$$s+t$$$; 3. prin...
2,200
false
false
false
true
false
false
false
false
false
false
1,955
65C
Brothers Fred and George Weasley once got into the sporting goods store and opened a box of Quidditch balls. After long and painful experiments they found out that the Golden Snitch is not enchanted at all. It is simply a programmed device. It always moves along the same trajectory, which is a polyline with vertices at...
2,100
false
false
false
false
false
false
false
true
false
false
9,644
1385C
You are given an array $$$a$$$ consisting of $$$n$$$ integers. You have to find the length of the smallest (shortest) prefix of elements you need to erase from $$$a$$$ to make it a good array. Recall that the prefix of the array $$$a=[a_1, a_2, dots, a_n]$$$ is a subarray consisting several first elements: the prefix o...
1,200
false
true
false
false
false
false
false
false
false
false
3,745
1989C
A movie company has released $$$2$$$ movies. These $$$2$$$ movies were watched by $$$n$$$ people. For each person, we know their attitude towards the first movie (liked it, neutral, or disliked it) and towards the second movie. If a person is asked to leave a review for the movie, then: if that person liked the movie,...
1,400
true
true
false
false
false
false
false
false
false
false
339
1832E
Recall that the binomial coefficient $$$binom{x}{y}$$$ is calculated as follows ($$$x$$$ and $$$y$$$ are non-negative integers): if $$$x < y$$$, then $$$binom{x}{y} = 0$$$; otherwise, $$$binom{x}{y} = frac{x!}{y! cdot (x-y)!}$$$. You are given an array $$$a_1, a_2, dots, a_n$$$ and an integer $$$k$$$. You have to cal...
2,200
false
false
false
true
false
false
true
false
false
false
1,293
774B
Stepan is a very experienced olympiad participant. He has _n_ cups for Physics olympiads and _m_ cups for Informatics olympiads. Each cup is characterized by two parameters — its significance _c__i_ and width _w__i_. Stepan decided to expose some of his cups on a shelf with width _d_ in such a way, that: there is at l...
2,100
false
false
false
false
true
false
false
true
false
false
6,680
1047B
Problem - 1047B - 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 - ...
900
true
false
false
false
false
false
false
false
false
false
5,456
1846D
Rudolph drew a beautiful Christmas tree and decided to print the picture. However, the ink in the cartridge often runs out at the most inconvenient moment. Therefore, Rudolph wants to calculate in advance how much green ink he will need. The tree is a vertical trunk with identical triangular branches at different heigh...
1,200
true
false
false
false
false
true
false
false
false
false
1,205
235C
Some days ago, WJMZBMR learned how to answer the query "how many times does a string _x_ occur in a string _s_" quickly by preprocessing the string _s_. But now he wants to make it harder. So he wants to ask "how many consecutive substrings of _s_ are cyclical isomorphic to a given string _x_". You are given string _s_...
2,700
false
false
false
false
true
false
false
false
false
false
8,894
1185A
Polycarp decided to relax on his weekend and visited to the performance of famous ropewalkers: Agafon, Boniface and Konrad. The rope is straight and infinite in both directions. At the beginning of the performance, Agafon, Boniface and Konrad are located in positions $$$a$$$, $$$b$$$ and $$$c$$$ respectively. At the en...
800
true
false
false
false
false
false
false
false
false
false
4,780
1294E
You are given a rectangular matrix of size $$$n imes m$$$ consisting of integers from $$$1$$$ to $$$2 cdot 10^5$$$. In one move, you can: choose any element of the matrix and change its value to any integer between $$$1$$$ and $$$n cdot m$$$, inclusive; take any column and shift it one cell up cyclically (see the ex...
1,900
true
true
true
false
false
false
false
false
false
false
4,225
2005B2
This is the hard version of the problem. The only differences between the two versions are the constraints on $$$m$$$ and $$$q$$$. In this version, $$$m, q le 10^5$$$. You can make hacks only if both versions of the problem are solved. Narek and Tsovak were busy preparing this round, so they have not managed to do thei...
1,200
true
true
false
false
false
false
false
true
true
false
222
1579E1
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 744 (Div. 3) 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...
1,000
true
true
false
false
false
true
false
false
false
false
2,737
1906L
Construct a parentheses sequence consisting of $$$N$$$ characters such that it is balanced and the length of its longest palindromic subsequence (LPS) is exactly $$$K$$$. Determine whether such a construction is possible. If there are several possible sequences, construct any of them. A parentheses sequence consists of...
2,500
false
false
false
false
false
true
false
false
false
false
866
201B
A widely known among some people Belarusian sport programmer Yura possesses lots of information about cars. That is why he has been invited to participate in a game show called "Guess That Car!". The game show takes place on a giant parking lot, which is 4_n_ meters long from north to south and 4_m_ meters wide from we...
1,800
true
false
false
false
false
false
false
false
false
false
9,038
1916H1
Problem - 1916H1 - Codeforces =============== xa0 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output This is the easy version of the problem. The only differences between the two versions of this problem are the constraints on $$$k$$$. You can ma...
2,700
true
false
false
true
false
false
true
false
false
false
796
125A
Problem - 125A - Codeforces =============== xa0 . Output Print two non-negative space-separated integers _a_ and _b_, where _a_ is the numbers of feet and _b_ is the number of inches. Examples Input 42 Output 1 2 Input 5 Output 0 2
1,400
true
false
false
false
false
false
false
false
false
false
9,382
1525E
Monocarp is playing a game "Assimilation IV". In this game he manages a great empire: builds cities and conquers new lands. Monocarp's empire has $$$n$$$ cities. In order to conquer new lands he plans to build one Monument in each city. The game is turn-based and, since Monocarp is still amateur, he builds exactly one ...
2,100
true
false
false
true
false
false
false
false
false
false
3,038
1840C
Dima Vatrushin is a math teacher at school. He was sent on vacation for $$$n$$$ days for his good work. Dima has long dreamed of going to a ski resort, so he wants to allocate several consecutive days and go skiing. Since the vacation requires careful preparation, he will only go for at least $$$k$$$ days. You are give...
1,000
true
false
false
false
false
false
false
false
false
false
1,251
1517G
At the foot of Liyushan Mountain, $$$n$$$ tents will be carefully arranged to provide accommodation for those who are willing to experience the joy of approaching nature, the tranquility of the night, and the bright starry sky. The $$$i$$$-th tent is located at the point of $$$(x_i, y_i)$$$ and has a weight of $$$w_i$$...
3,300
false
false
false
false
false
true
false
false
false
true
3,071
1108D
You have a garland consisting of $$$n$$$ lamps. Each lamp is colored red, green or blue. The color of the $$$i$$$-th lamp is $$$s_i$$$ ('R', 'G' and 'B' — colors of lamps in the garland). You have to recolor some lamps in this garland (recoloring a lamp means changing its initial color to another) in such a way that th...
1,400
false
true
false
true
false
true
false
false
false
false
5,159
1725L
Pak Chanek is participating in a lemper cooking competition. In the competition, Pak Chanek has to cook lempers with $$$N$$$ stoves that are arranged sequentially from stove $$$1$$$ to stove $$$N$$$. Initially, stove $$$i$$$ has a temperature of $$$A_i$$$ degrees. A stove can have a negative temperature. Pak Chanek rea...
2,400
false
false
false
false
true
false
false
false
false
false
1,935
677A
Vanya and his friends are walking along the fence of height _h_ and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed _h_. If the height of some person is greater than _h_ he can bend down and then he surely won't be noticed by the guard. The height ...
800
false
false
true
false
false
false
false
false
false
false
7,121
1494B
Berland crossword is a puzzle that is solved on a square grid with $$$n$$$ rows and $$$n$$$ columns. Initially all the cells are white. To solve the puzzle one has to color some cells on the border of the grid black in such a way that: exactly $$$U$$$ cells in the top row are black; exactly $$$R$$$ cells in the right...
1,400
false
true
true
false
false
false
true
false
false
false
3,201
449A
Jzzhu has a big rectangular chocolate bar that consists of _n_u2009×u2009_m_ unit squares. He wants to cut this bar exactly _k_ times. Each cut must meet the following requirements: each cut should be straight (horizontal or vertical); each cut should go along edges of unit squares (it is prohibited to divide any uni...
1,700
true
true
false
false
false
false
false
false
false
false
8,044
833E
It is well-known that the best decoration for a flower bed in Sweetland are vanilla muffins. Seedlings of this plant need sun to grow up. Slastyona has _m_ seedlings, and the _j_-th seedling needs at least _k__j_ minutes of sunlight to grow up. Most of the time it's sunny in Sweetland, but sometimes some caramel clouds...
3,400
false
false
false
true
true
false
false
false
true
false
6,430
2006F
Sadly, Dora poured the paint when painting the class mural. Dora considers the mural as the matrix $$$b$$$ of size $$$n imes n$$$. Initially, $$$b_{i,j} = 0$$$ for all $$$1 le i, j le n$$$. Dora has only two brushes which have two different colors. In one operation, she can paint the matrix with one of two brushes: T...
3,500
false
false
true
false
false
true
true
false
false
true
212
1284B
A sequence $$$a = [a_1, a_2, ldots, a_l]$$$ of length $$$l$$$ has an ascent if there exists a pair of indices $$$(i, j)$$$ such that $$$1 le i < j le l$$$ and $$$a_i < a_j$$$. For example, the sequence $$$[0, 2, 0, 2, 0]$$$ has an ascent because of the pair $$$(1, 4)$$$, but the sequence $$$[4, 3, 3, 3, 1]$$$ doesn't h...
1,400
false
false
true
true
true
false
false
true
true
false
4,273
272B
Problem - 272B - 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,400
true
false
true
false
false
false
false
false
false
false
8,745
1851B
You have an array of integers $$$a$$$ of length $$$n$$$. You can apply the following operation to the given array: Swap two elements $$$a_i$$$ and $$$a_j$$$ such that $$$i eq j$$$, $$$a_i$$$ and $$$a_j$$$ are either both even or both odd. Determine whether it is possible to sort the array in non-decreasing order by p...
800
false
true
false
false
false
false
false
false
true
false
1,173
1949I
You are given $$$n$$$ disks in the plane. The center of each disk has integer coordinates, and the radius of each disk is a positive integer. No two disks overlap in a region of positive area, but it is possible for disks to be tangent to each other. Your task is to determine whether it is possible to change the radii ...
1,800
false
false
false
false
false
false
false
false
false
true
584
260A
Problem - 260A - 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,400
true
false
true
false
false
false
false
false
false
false
8,795
1488G
Problem - 1488G - Codeforces =============== xa0 . The cost of painting is the number of pairs $$$(x, y)$$$ such that $$$y bmod x = 0$$$, $$$y$$$ is red and $$$x$$$ is blue. For each $$$k in
2,500
false
true
false
false
true
false
false
false
false
false
3,233
470A
Problem - 470A - Codeforces =============== xa0 points on each side. The formula is _H__n_u2009=u20093·_n_·(_n_u2009+u20091)u2009+u20091. You are given _n_; calculate _n_-th element of the sequence. Input The only line of input contains an integer _n_ (0u2009≤u2009_n_u2009≤u20099). Output Output the _n_-t...
1,400
false
false
true
false
false
false
false
false
false
false
7,960
547B
Problem - 547B - 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
false
false
false
true
true
false
false
true
false
false
7,651
1552B
The Olympic Games have just started and Federico is eager to watch the marathon race. There will be $$$n$$$ athletes, numbered from $$$1$$$ to $$$n$$$, competing in the marathon, and all of them have taken part in $$$5$$$ important marathons, numbered from $$$1$$$ to $$$5$$$, in the past. For each $$$1le ile n$$$ and $...
1,500
false
true
false
false
false
false
false
false
true
true
2,883
1630E
Given a cyclic array $$$a$$$ of size $$$n$$$, where $$$a_i$$$ is the value of $$$a$$$ in the $$$i$$$-th position, there may be repeated values. Let us define that a permutation of $$$a$$$ is equal to another permutation of $$$a$$$ if and only if their values are the same for each position $$$i$$$ or we can transform th...
2,900
true
false
false
false
false
false
false
false
false
false
2,462
720C
Today Peter has got an additional homework for tomorrow. The teacher has given three integers to him: _n_, _m_ and _k_, and asked him to mark one or more squares on a square grid of size _n_u2009×u2009_m_. The marked squares must form a connected figure, and there must be exactly _k_ triples of marked squares that form...
3,100
false
false
false
false
false
true
false
false
false
false
6,935
903B
Vova is again playing some computer game, now an RPG. In the game Vova's character received a quest: to slay the fearsome monster called Modcrab. After two hours of playing the game Vova has tracked the monster and analyzed its tactics. The Modcrab has _h_2 health points and an attack power of _a_2. Knowing that, Vova ...
1,200
false
true
true
false
false
false
false
false
false
false
6,133
110A
Problem - 110A - 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...
800
false
false
true
false
false
false
false
false
false
false
9,444
285B
Petya and Vasya are playing a game. Petya's got _n_ non-transparent glasses, standing in a row. The glasses' positions are indexed with integers from 1 to _n_ from left to right. Note that the positions are indexed but the glasses are not. First Petya puts a marble under the glass in position _s_. Then he performs some...
1,200
false
false
true
false
false
false
false
false
false
false
8,695
629E
Famil Door’s City map looks like a tree (undirected connected acyclic graph) so other people call it Treeland. There are _n_ intersections in the city connected by _n_u2009-u20091 bidirectional roads. There are _m_ friends of Famil Door living in the city. The _i_-th friend lives at the intersection _u__i_ and works at...
2,300
false
false
false
true
true
false
false
false
false
false
7,305
711E
ZS the Coder has recently found an interesting concept called the Birthday Paradox. It states that given a random set of 23 people, there is around 50% chance that some two of them share the same birthday. ZS the Coder finds this very interesting, and decides to test this with the inhabitants of Udayland. In Udayland, ...
2,300
true
false
false
false
false
false
false
false
false
false
6,972
1935A
Congratulations, you have been accepted to the Master's Assistance Center! However, you were extremely bored in class and got tired of doing nothing, so you came up with a game for yourself. You are given a string $$$s$$$ and an even integer $$$n$$$. There are two types of operations that you can apply to it: 1. Add th...
800
false
false
false
false
false
true
false
false
false
false
674
1848A
Vika and her friends went shopping in a mall, which can be represented as a rectangular grid of rooms with sides of length $$$n$$$ and $$$m$$$. Each room has coordinates $$$(a, b)$$$, where $$$1 le a le n, 1 le b le m$$$. Thus we call a hall with coordinates $$$(c, d)$$$ a neighbouring for it if $$$a - c + b - d = 1$$$...
900
true
false
false
false
false
false
false
false
false
false
1,194
1879A
Monocarp organizes a weightlifting competition. There are $$$n$$$ athletes participating in the competition, the $$$i$$$-th athlete has strength $$$s_i$$$ and endurance $$$e_i$$$. The $$$1$$$-st athlete is Monocarp's friend Polycarp, and Monocarp really wants Polycarp to win. The competition will be conducted as follow...
800
false
true
false
false
false
false
false
false
false
false
1,010
1580D
Alice has an integer sequence $$$a$$$ of length $$$n$$$ and all elements are different. She will choose a subsequence of $$$a$$$ of length $$$m$$$, and defines the value of a subsequence $$$a_{b_1},a_{b_2},ldots,a_{b_m}$$$ as $$$$$$sum_{i = 1}^m (m cdot a_{b_i}) - sum_{i = 1}^m sum_{j = 1}^m f(min(b_i, b_j), max(b_i, b...
2,900
false
true
false
true
false
false
true
false
false
false
2,730
1934A
Given an array $$$a$$$ of $$$n$$$ elements, find the maximum value of the expression: $$$$$$a_i - a_j + a_j - a_k + a_k - a_l + a_l - a_i$$$$$$ where $$$i$$$, $$$j$$$, $$$k$$$, and $$$l$$$ are four distinct indices of the array $$$a$$$, with $$$1 le i, j, k, l le n$$$. Here $$$x$$$ denotes the absolute value of $$$x$$$...
800
true
true
false
false
false
false
false
false
false
false
680
335D
You are given _n_ rectangles, labeled 1 through _n_. The corners of rectangles have integer coordinates and their edges are parallel to the _Ox_ and _Oy_ axes. The rectangles may touch each other, but they do not overlap (that is, there are no points that belong to the interior of more than one rectangle). Your task is...
2,400
false
false
false
true
false
false
true
false
false
false
8,495
1497E1
This is the easy version of the problem. The only difference is that in this version $$$k = 0$$$. There is an array $$$a_1, a_2, ldots, a_n$$$ of $$$n$$$ positive integers. You should divide it into a minimal number of continuous segments, such that in each segment there are no two numbers (on different positions), who...
1,700
true
true
false
true
true
false
false
false
false
false
3,183
1304C
Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it. Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperature ranges! Looking through the reservation list, he wants to satisfy all custom...
1,500
false
true
true
true
false
false
false
false
true
false
4,169
1257G
You are given an integer $$$x$$$ represented as a product of $$$n$$$ its prime divisors $$$p_1 cdot p_2, cdot ldots cdot p_n$$$. Let $$$S$$$ be the set of all positive integer divisors of $$$x$$$ (including $$$1$$$ and $$$x$$$ itself). We call a set of integers $$$D$$$ good if (and only if) there is no pair $$$a in D$$...
2,600
true
true
false
false
false
false
false
false
false
false
4,395
431E
One day two students, Grisha and Diana, found themselves in the university chemistry lab. In the lab the students found _n_ test tubes with mercury numbered from 1 to _n_ and decided to conduct an experiment. The experiment consists of _q_ steps. On each step, one of the following actions occurs: 1. Diana pours all the...
2,200
false
false
false
false
true
false
false
true
false
false
8,115
1491D
There is a new attraction in Singapore Zoo: The Infinite Zoo. The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $$$1,2,3,ldots$$$. There is a directed edge from vertex $$$u$$$ to vertex $$$u+v$$$ if and only if $$$u&v=v$$$, where $$$&$$$ denotes the — the number of queries. The ...
1,800
true
true
false
true
false
true
false
false
false
false
3,219
1282A
Polycarp lives on the coordinate axis $$$Ox$$$ and travels from the point $$$x=a$$$ to $$$x=b$$$. It moves uniformly rectilinearly at a speed of one unit of distance per minute. On the axis $$$Ox$$$ at the point $$$x=c$$$ the base station of the mobile operator is placed. It is known that the radius of its coverage is ...
900
true
false
true
false
false
false
false
false
false
false
4,286
309E
Information technologies are developing and are increasingly penetrating into all spheres of human activity. Incredible as it is, the most modern technology are used in farming! A large farm has a meadow with grazing sheep. Overall there are _n_ sheep and each of them contains a unique number from 1 to _n_ — because th...
2,900
false
true
false
false
false
false
false
true
false
false
8,603
1384A
The length of the longest common prefix of two strings $$$s = s_1 s_2 ldots s_n$$$ and $$$t = t_1 t_2 ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 le k le min(n,m)$$$) such that $$$s_1 s_2 ldots s_k$$$ equals $$$t_1 t_2 ldots t_k$$$. Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, dots, s_{n+...
1,200
false
true
false
false
false
true
false
false
false
false
3,750
1658D2
This is the hard version of the problem. The difference in the constraints between both versions are colored below in red. You can make hacks only if all versions of the problem are solved. Marin and Gojou are playing hide-and-seek with an array. Gojou initially perform the following steps: First, Gojou chooses $$$2$$...
2,300
true
false
false
false
true
false
true
false
false
false
2,335
1842D
Tell a story about me and my animal friends. Tenzing has $$$n$$$ animal friends. He numbers them from $$$1$$$ to $$$n$$$. One day Tenzing wants to play with his animal friends. To do so, Tenzing will host several games. In one game, he will choose a set $$$S$$$ which is a subset of $$${1,2,3,...,n}$$$ and choose an int...
1,900
false
true
false
false
false
true
false
false
false
true
1,236
506E
Problem - 506E - 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...
3,000
false
false
false
true
false
false
false
false
false
false
7,817
60D
Problem - 60D - Codeforces =============== xa0 can transfer laugh to other lawn (say, _j_) if there exists an integer (say, _b_) such, that some permutation of numbers _a_
2,500
true
false
false
false
false
false
true
false
false
false
9,672
1034E
Little C loves number «3» very much. He loves all things about it. Now he is interested in the following problem: There are two arrays of $$$2^n$$$ intergers $$$a_0,a_1,...,a_{2^n-1}$$$ and $$$b_0,b_1,...,b_{2^n-1}$$$. The task is for each $$$i (0 leq i leq 2^n-1)$$$, to calculate $$$c_i=sum a_j cdot b_k$$$ ($$$jk=i$$$...
3,200
true
false
false
true
false
false
false
false
false
false
5,524
710C
. Output Print _n_ lines with _n_ integers. All the integers should be different and from 1 to _n_2. The sum in each row, column and both main diagonals should be odd.
1,500
true
false
false
false
false
true
false
false
false
false
6,980
1968C
You are given an array $$$x_2,x_3,dots,x_n$$$. Your task is to find any array $$$a_1,dots,a_n$$$, where: $$$1le a_ile 10^9$$$ for all $$$1le ile n$$$. $$$x_i=a_i bmod a_{i-1}$$$ for all $$$2le ile n$$$. Here $$$cbmod d$$$ denotes the remainder of the division of the integer $$$c$$$ by the integer $$$d$$$. For example...
1,000
false
false
false
false
false
true
false
false
false
false
498
1806A
YunQian is standing on an infinite plane with the Cartesian coordinate system on it. In one move, she can move to the diagonally adjacent point on the top right or the adjacent point on the left. That is, if she is standing on point $$$(x,y)$$$, she can either move to point $$$(x+1,y+1)$$$ or point $$$(x-1,y)$$$. YunQi...
800
true
true
false
false
false
false
false
false
false
false
1,442
932G
Problem - 932G - 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,900
false
false
false
true
false
false
false
false
false
false
5,972
648D
Statement is not available on English language На координатной прямой сидит _n_ собачек, _i_-я собачка находится в точке _x__i_. Кроме того, на прямой есть _m_ мисок с едой, для каждой известна её координата на прямой _u__j_ и время _t__j_, через которое еда в миске остынет и станет невкусной. Это значит, что если соба...
1,900
false
true
false
false
true
false
false
false
true
false
7,224
510D
Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0. There are also _n_ cards, each card has 2 attributes: length _l__i_ and cost _c__i_. If she pays _c__i_ dollars then she can apply _i_-th ...
1,900
true
false
false
true
false
false
true
false
false
false
7,797
1253A
You're given two arrays $$$a[1 dots n]$$$ and $$$b[1 dots n]$$$, both of the same length $$$n$$$. In order to perform a push operation, you have to choose three integers $$$l, r, k$$$ satisfying $$$1 le l le r le n$$$ and $$$k > 0$$$. Then, you will add $$$k$$$ to elements $$$a_l, a_{l+1}, ldots, a_r$$$. For example, i...
1,000
false
false
true
false
false
false
false
false
false
false
4,422
117E
You are given an undirected connected graph _G_ consisting of _n_ vertexes and _n_ edges. _G_ contains no self-loops or multiple edges. Let each edge has two states: on and off. Initially all edges are switched off. You are also given _m_ queries represented as (_v_,u2009_u_) — change the state of all edges on the shor...
2,900
false
false
true
false
true
false
false
false
false
false
9,417
1227C
You are fed up with your messy room, so you decided to clean it up. Your room is a bracket sequence $$$s=s_{1}s_{2}dots s_{n}$$$ of length $$$n$$$. Each character of this string is either an opening bracket '(' or a closing bracket ')'. In one operation you can choose any consecutive substring of $$$s$$$ and reverse it...
1,700
false
false
false
false
false
true
false
false
false
false
4,542
1862F
A portal of dark forces has opened at the border of worlds, and now the whole world is under a terrible threat. To close the portal and save the world, you need to defeat $$$n$$$ monsters that emerge from the portal one after another. Only the sorceress Vika can handle this. She possesses two magical powersxa0— water m...
1,800
false
false
false
true
false
false
true
true
false
false
1,108
156B
As Sherlock Holmes was investigating a crime, he identified _n_ suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to _n_. After that, he asked each one: "Which one committed the crime?". Suspect number _i_...
1,600
false
false
true
false
true
true
false
false
false
false
9,251
1265E
Creatnx has $$$n$$$ mirrors, numbered from $$$1$$$ to $$$n$$$. Every day, Creatnx asks exactly one mirror "Am I beautiful?". The $$$i$$$-th mirror will tell Creatnx that he is beautiful with probability $$$frac{p_i}{100}$$$ for all $$$1 le i le n$$$. Creatnx asks the mirrors one by one, starting from the $$$1$$$-st mir...
2,100
true
false
false
true
true
false
false
false
false
false
4,372
1575H
The Winter holiday will be here soon. Mr. Chanek wants to decorate his house's wall with ornaments. The wall can be represented as a binary string $$$a$$$ of length $$$n$$$. His favorite nephew has another binary string $$$b$$$ of length $$$m$$$ ($$$m leq n$$$). Mr. Chanek's nephew loves the non-negative integer $$$k$$...
2,200
false
false
false
true
false
false
false
false
false
false
2,761
1537A
An array $$$b$$$ of length $$$k$$$ is called good if its arithmetic mean is equal to $$$1$$$. More formally, if $$$$$$frac{b_1 + cdots + b_k}{k}=1.$$$$$$ Note that the value $$$frac{b_1+cdots+b_k}{k}$$$ is not rounded up or down. For example, the array $$$[1,1,1,2]$$$ has an arithmetic mean of $$$1.25$$$, which is not ...
800
true
true
false
false
false
false
false
false
false
false
2,962
733E
The academic year has just begun, but lessons and olympiads have already occupied all the free time. It is not a surprise that today Olga fell asleep on the Literature. She had a dream in which she was on a stairs. The stairs consists of _n_ steps. The steps are numbered from bottom to top, it means that the lowest ste...
2,400
true
false
false
false
true
true
false
false
false
false
6,860
1067D
Ivan plays some computer game. There are $$$n$$$ quests in the game. Each quest can be upgraded once, this increases the reward for its completion. Each quest has $$$3$$$ parameters $$$a_{i}$$$, $$$b_{i}$$$, $$$p_{i}$$$: reward for completing quest before upgrade, reward for completing quest after upgrade ($$$a_{i} < b...
3,100
true
true
false
true
false
false
false
false
false
false
5,372
1493B
The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts $$$h$$$ hours and each hour lasts $$$m$$$ minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colo...
1,300
false
false
true
false
false
false
true
false
false
false
3,207
819A
Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens. All characters in this game are lowercase English letters. There are two players: Mister B and his competitor. Initially the players have a string _s_ consisting of the...
2,200
false
true
false
false
false
false
false
false
false
false
6,480
1239F
I'm the Map, I'm the Map! I'm the MAP!!! Map In anticipation of new adventures Boots wanted to do a good deed. After discussion with the Map and Backpack, they decided to gift Dora a connected graph. After a long search, Boots chose $$$t$$$ graph's variants, which Dora might like. However fox Swiper wants to spoil his ...
3,400
false
false
true
false
false
false
false
false
false
true
4,491
997E
A permutation $$$p$$$ of length $$$n$$$ is a sequence $$$p_1, p_2, ldots, p_n$$$ consisting of $$$n$$$ distinct integers, each of which from $$$1$$$ to $$$n$$$ ($$$1 leq p_i leq n$$$) . Let's call the subsegment $$$[l,r]$$$ of the permutation good if all numbers from the minimum on it to the maximum on this subsegment ...
3,000
false
false
false
false
true
false
false
false
false
false
5,714
1793D
In winter, the inhabitants of the Moscow Zoo are very bored, in particular, it concerns gorillas. You decided to entertain them and brought a permutation $$$p$$$ of length $$$n$$$ to the zoo. A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in any order. For ex...
1,800
true
true
true
true
false
false
false
true
false
false
1,517
1017G
Abendsen assigned a mission to Juliana. In this mission, Juliana has a rooted tree with $$$n$$$ vertices. Vertex number $$$1$$$ is the root of this tree. Each vertex can be either black or white. At first, all vertices are white. Juliana is asked to process $$$q$$$ queries. Each query is one of three types: 1. If verte...
3,200
false
false
false
false
true
false
false
false
false
false
5,599
1717F
Oh no, on the first exam Madoka got this hard problem: Given integer $$$n$$$ and $$$m$$$ pairs of integers ($$$v_i, u_i$$$). Also there is an array $$$b_1, b_2, ldots, b_n$$$, initially filled with zeros. Then for each index $$$i$$$, where $$$1 leq i leq m$$$, perform either $$$b_{v_i} := b_{v_i} - 1$$$ and $$$b_{u_i} ...
2,500
false
false
true
false
false
true
false
false
false
true
1,976
1268D
You are given a tournamentxa0— complete directed graph. In one operation you can pick any vertex $$$v$$$ and change the direction of all edges with $$$v$$$ on one of the ends (i.e all edges $$$u o v$$$ change their orientation to $$$v o u$$$ and vice versa). You want to make the tournament strongly connected with the...
3,200
true
false
false
false
false
false
true
false
false
true
4,348
77C
Eat a beaver, save a tree!" — That will be the motto of ecologists' urgent meeting in Beaverley Hills. And the whole point is that the population of beavers on the Earth has reached incredible sizes! Each day their number increases in several times and they don't even realize how much their unhealthy obsession with tre...
2,100
false
true
false
true
false
false
false
false
false
false
9,578