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
331B2
The Smart Beaver has recently designed and built an innovative nanotechnologic all-purpose beaver mass shaving machine, "Beavershave 5000". Beavershave 5000 can shave beavers by families! How does it work? Very easily! There are _n_ beavers, each of them has a unique id from 1 to _n_. Consider a permutation _a_1,u2009_...
1,900
false
false
false
false
true
false
false
false
false
false
8,519
1540C2
This is the hard version of the problem. The only difference is that in this version $$$1 le q le 10^5$$$. You can make hacks only if both versions of the problem are solved. There is a process that takes place on arrays $$$a$$$ and $$$b$$$ of length $$$n$$$ and length $$$n-1$$$ respectively. The process is an infinite...
2,900
true
false
false
true
false
false
false
false
false
false
2,939
1764C
Doremy's new city is under construction! The city can be regarded as a simple undirected graph with $$$n$$$ vertices. The $$$i$$$-th vertex has altitude $$$a_i$$$. Now Doremy is deciding which pairs of vertices should be connected with edges. Due to economic reasons, there should be no self-loops or multiple edges in t...
1,400
false
true
false
false
false
false
false
false
false
true
1,725
297B
It is known that there are _k_ fish species in the polar ocean, numbered from 1 to _k_. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the _i_-th type of fish be _w__i_, then 0u2009<u2009_w_1u2009≤u2009_w_2u2009≤u2009...u2009≤u2009_w__k_ holds. Polar bears Alice a...
1,600
false
true
false
false
false
true
false
false
false
false
8,643
1903E
This is an interactive problem. Theofanis and his sister are playing the following game. They have $$$n$$$ points in a 2D plane and a starting point $$$(s_x,s_y)$$$. Each player (starting from the first player) chooses one of the $$$n$$$ points that wasn't chosen before and adds to the sum (which is initially $$$0$$$) ...
2,000
true
true
false
false
false
false
false
false
false
false
892
1804A
You are given a checkerboard of size $$$201 imes 201$$$, i.xa0e. it has $$$201$$$ rows and $$$201$$$ columns. The rows of this checkerboard are numbered from $$$-100$$$ to $$$100$$$ from bottom to top. The columns of this checkerboard are numbered from $$$-100$$$ to $$$100$$$ from left to right. The notation $$$(r, c)...
800
true
true
false
false
false
false
false
false
false
false
1,457
1349A
For the multiset of positive integers $$$s={s_1,s_2,dots,s_k}$$$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $$$s$$$ as follow: $$$gcd(s)$$$ is the maximum positive integer $$$x$$$, such that all integers in $$$s$$$ are divisible on $$$x$$$. $$$ extrm{lcm}(s)$$$ is the minimum positiv...
1,600
true
false
false
false
true
false
false
false
false
false
3,964
31E
Problem - 31E - 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,400
false
false
false
true
false
false
false
false
false
false
9,839
1799E
You are given $$$n imes m$$$ grid. Some cells are filled and some are empty. A city is a maximal (by inclusion) set of filled cells such that it is possible to get from any cell in the set to any other cell in the set by moving to adjacent (by side) cells, without moving into any cells not in the set. In other words, ...
2,300
true
true
true
false
false
true
false
false
false
false
1,479
1899B
Alex is participating in the filming of another video of BrMeast, and BrMeast asked Alex to prepare 250 thousand tons of TNT, but Alex didn't hear him well, so he prepared $$$n$$$ boxes and arranged them in a row waiting for trucks. The $$$i$$$-th box from the left weighs $$$a_i$$$ tons. All trucks that Alex is going t...
1,100
false
false
true
false
false
false
true
false
false
false
921
1867B
You are given a binary string $$$s$$$ of length $$$n$$$ (a string that consists only of $$$0$$$ and $$$1$$$). A number $$$x$$$ is good if there exists a binary string $$$l$$$ of length $$$n$$$, containing $$$x$$$ ones, such that if each symbol $$$s_i$$$ is replaced by $$$s_i oplus l_i$$$ (where $$$oplus$$$ denotes the ...
1,100
false
false
false
false
false
true
false
false
false
false
1,074
442A
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, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding _n_ cards. The game is somewhat complicated by the fact that everybody sees Borya's cards exce...
1,700
false
false
true
false
false
false
true
false
false
false
8,070
28C
Problem - 28C - 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
true
false
false
false
false
false
false
9,856
1254D
Hanh is a famous biologist. He loves growing trees and doing experiments on his own garden. One day, he got a tree consisting of $$$n$$$ vertices. Vertices are numbered from $$$1$$$ to $$$n$$$. A tree with $$$n$$$ vertices is an undirected connected graph with $$$n-1$$$ edges. Initially, Hanh sets the value of every ve...
2,700
false
false
false
false
true
false
false
false
false
false
4,412
1762C
A binary string$$$^dagger$$$ $$$b$$$ of odd length $$$m$$$ is good if $$$b_i$$$ is the median$$$^ddagger$$$ of $$$b[1,i]^S$$$ for all odd indices $$$i$$$ ($$$1 leq i leq m$$$). For a binary string $$$a$$$ of length $$$k$$$, a binary string $$$b$$$ of length $$$2k-1$$$ is an extension of $$$a$$$ if $$$b_{2i-1}=a_i$$$ fo...
1,400
true
false
false
false
false
false
false
false
false
false
1,738
1754B
For his birthday, Kevin received the set of pairwise distinct numbers $$$1, 2, 3, ldots, n$$$ as a gift. He is going to arrange these numbers in a way such that the minimum absolute difference between two consecutive numbers be maximum possible. More formally, if he arranges numbers in order $$$p_1, p_2, ldots, p_n$$$,...
800
true
true
false
false
false
true
false
false
false
false
1,769
1153E
This is an interactive problem. Now Serval is a senior high school student in Japari Middle School. However, on the way to the school, he must go across a pond, in which there is a dangerous snake. The pond can be represented as a $$$n imes n$$$ grid. The snake has a head and a tail in different cells, and its body is...
2,200
false
false
false
false
false
false
true
true
false
false
4,945
1462E1
This is the easy version of this problem. The only difference between easy and hard versions is the constraints on $$$k$$$ and $$$m$$$ (in this version $$$k=2$$$ and $$$m=3$$$). Also, in this version of the problem, you DON'T NEED to output the answer by modulo. You are given a sequence $$$a$$$ of length $$$n$$$ consis...
1,500
true
false
false
false
false
false
false
true
true
false
3,376
380B
Sereja adores trees. Today he came up with a revolutionary new type of binary root trees. His new tree consists of _n_ levels, each vertex is indexed by two integers: the number of the level and the number of the vertex on the current level. The tree root is at level 1, its index is (1,u20091). Here is a pseudo code of...
2,400
false
false
true
false
false
false
false
false
false
true
8,309
1806F1
This is the easy version of the problem. The only difference between the two versions is the constraint on $$$m$$$. You can make hacks only if both versions of the problem are solved. You are given an array $$$a$$$ of length $$$n$$$ and two integers $$$m$$$ and $$$k$$$. Each element in $$$a$$$ satisfies $$$1le a_i le m...
2,900
true
true
false
false
false
false
false
false
true
false
1,437
331C3
Yet another Armageddon is coming! This time the culprit is the Julya tribe calendar. The beavers in this tribe knew math very well. Smart Beaver, an archaeologist, got a sacred plate with a magic integer on it. The translation from Old Beaverish is as follows: "May the Great Beaver bless you! May your chacres open and ...
2,500
false
false
false
true
false
false
false
false
false
false
8,516
1450E
A society can be represented by a connected, undirected graph of $$$n$$$ vertices and $$$m$$$ edges. The vertices represent people, and an edge $$$(i,j)$$$ represents a friendship between people $$$i$$$ and $$$j$$$. In society, the $$$i$$$-th person has an income $$$a_i$$$. A person $$$i$$$ is envious of person $$$j$$$...
2,700
false
false
false
false
false
true
false
false
false
true
3,433
480D
Jaroslav owns a small courier service. He has recently got and introduced a new system of processing parcels. Each parcel is a box, the box has its weight and strength. The system works as follows. It originally has an empty platform where you can put boxes by the following rules: If the platform is empty, then the bo...
2,600
false
false
false
true
false
false
false
false
false
true
7,911
547C
Mike is a bartender at Rico's bar. At Rico's, they put beer glasses in a special shelf. There are _n_ kinds of beer at Rico's numbered from 1 to _n_. _i_-th kind of beer has _a__i_ milliliters of foam on it. Maxim is Mike's boss. Today he told Mike to perform _q_ queries. Initially the shelf is empty. In each request, ...
2,300
true
false
false
true
false
false
false
false
false
false
7,650
361B
Problem - 361B - 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,200
true
false
false
false
false
true
false
false
false
false
8,388
407C
Problem - 407C - 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
true
false
false
false
true
false
false
false
8,196
1106E
Lunar New Year is approaching, and Bob is going to receive some red envelopes with countless money! But collecting money from red envelopes is a time-consuming process itself. Let's describe this problem in a mathematical way. Consider a timeline from time $$$1$$$ to $$$n$$$. The $$$i$$$-th red envelope will be availab...
2,100
false
false
false
true
true
false
false
false
false
false
5,171
331A2
— Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me? — Of course, my Smart Beaver! Let us enjoy the splendid view together. How about Friday night? At this point the Smart Beaver got rushing. Everything should be perfect by Friday, so he needed to prepare the belt to the upcoming wa...
1,500
false
false
false
false
true
false
false
false
true
false
8,521
1450C2
The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version. Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on Codeforces. In a Tic-Tac-Toe grid, there are $$$n$$$ rows and $$$n$$$ columns. ...
2,300
true
false
false
false
false
true
false
false
false
false
3,435
884A
Problem - 884A - Codeforces =============== xa0 — the number of days and the time required to read the book. The second line contains _n_ integers _a__i_ (0u2009≤u2009_a__i_u2009≤u200986400) — the time Luba has to spend on her work during _i_-th day. Output Print the minimum day Luba can finish reading th...
800
false
false
true
false
false
false
false
false
false
false
6,214
232E
John Doe has a field, which is a rectangular table of size _n_u2009×u2009_m_. We assume that the field rows are numbered from 1 to _n_ from top to bottom, and the field columns are numbered from 1 to _m_ from left to right. Then the cell of the field at the intersection of the _x_-th row and the _y_-th column has coord...
3,000
false
false
false
true
false
false
false
false
false
false
8,907
1921B
In order to test the hypothesis about the cats, the scientists must arrange the cats in the boxes in a specific way. Of course, they would like to test the hypothesis and publish a sensational article as quickly as possible, because they are too engrossed in the next hypothesis about the phone's battery charge. Scienti...
800
false
true
true
false
false
false
false
false
false
false
764
1034C
There are $$$n$$$ cities in the Kingdom of Autumn, numbered from $$$1$$$ to $$$n$$$. People can travel between any two cities using $$$n-1$$$ two-directional roads. This year, the government decides to separate the kingdom. There will be regions of different levels. The whole kingdom will be the region of level $$$1$$$...
2,700
false
false
false
true
false
false
false
false
false
false
5,526
285C
Problem - 285C - 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,200
false
true
true
false
false
false
false
false
true
false
8,694
1433C
There are $$$n$$$ piranhas with sizes $$$a_1, a_2, ldots, a_n$$$ in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium. Scientists of the Berland State University want to find if there is dominant piranha in the aquarium. The piranha is called dominant if it can eat all the other ...
900
false
true
false
false
false
true
false
false
false
false
3,497
1358A
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance. The park is a rectangular table with $$$n$$$ rows and $$$m$$$ columns, where the c...
800
true
true
false
false
false
false
false
false
false
false
3,897
1616A
Problem - 1616A - Codeforces =============== xa0 and negate these numbers (i.xa0e. change $$$x o (-x)$$$). What is the maximum number of different values in the array you can achieve? Input The first line of input contains one integer $$$t$$$ ($$$1 leq t leq 100$$$): the number of test cases. The next li...
800
false
false
true
false
false
false
false
false
false
false
2,556
82A
Sheldon, Leonard, Penny, Rajesh and Howard are in the queue for a "Double Cola" drink vending machine; there are no other people in the queue. The first one in the queue (Sheldon) buys a can, drinks it and doubles! The resulting two Sheldons go to the end of the queue. Then the next in the queue (Leonard) buys a can, d...
1,100
true
false
true
false
false
false
false
false
false
false
9,558
1809D
You are given a binary string $$$s$$$ consisting of only characters 0 and/or 1. You can perform several operations on this string (possibly zero). There are two types of operations: choose two consecutive elements and swap them. In order to perform this operation, you pay $$$10^{12}$$$ coins; choose any element from ...
1,800
false
true
false
false
false
true
false
false
false
false
1,417
72F
After the nationalization of the oil industry, Dr. Mosaddegh wants to dig some oil wells to extract all the oil in Persian Gulf. But Persian Gulf is huge and has an infinite amount of oil. So Dr. Mosaddegh works only on a rectangular plane of size _n_u2009×u2009_m_ of the Persian Gulf. Each of the cells in this rectang...
1,900
true
true
false
false
false
false
false
false
false
false
9,606
864C
A bus moves along the coordinate line _Ox_ from the point _x_u2009=u20090 to the point _x_u2009=u2009_a_. After starting from the point _x_u2009=u20090, it reaches the point _x_u2009=u2009_a_, immediately turns back and then moves to the point _x_u2009=u20090. After returning to the point _x_u2009=u20090 it immediately...
1,500
true
true
true
false
false
false
false
false
false
false
6,285
787B
Since the giant heads have appeared in the sky all humanity is in danger, so all Ricks and Mortys from all parallel universes are gathering in groups to find a solution to get rid of them. There are _n_ parallel universes participating in this event (_n_ Ricks and _n_ Mortys). I. e. each of _n_ universes has one Rick a...
1,300
true
true
true
false
false
false
false
false
false
false
6,622
959D
Problem - 959D - 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
true
false
false
false
true
false
false
false
false
5,874
228C
Little Vasya likes painting fractals very much. He does it like this. First the boy cuts out a 2u2009×u20092-cell square out of squared paper. Then he paints some cells black. The boy calls the cut out square a fractal pattern. Then he takes a clean square sheet of paper and paints a fractal by the following algorithm:...
2,000
false
false
false
true
false
false
false
false
false
false
8,926
385D
One day a bear lived on the _Oxy_ axis. He was afraid of the dark, so he couldn't move at night along the plane points that aren't lit. One day the bear wanted to have a night walk from his house at point (_l_,u20090) to his friend's house at point (_r_,u20090), along the segment of length (_r_u2009-u2009_l_). Of cours...
2,200
false
false
false
true
false
false
false
false
false
false
8,288
792E
Problem - 792E - Codeforces =============== xa0 balls of different colors (each set contains only balls of one color), there are no two sets such that the difference between their sizes is greater than 1. Print the minimum possible number of sets. Input The first line contains one integer number _n_ (1u2...
2,500
true
true
false
false
false
false
false
false
false
false
6,609
1082B
Vova has won $$$n$$$ trophies in different competitions. Each trophy is either golden or silver. The trophies are arranged in a row. The beauty of the arrangement is the length of the longest subsegment consisting of golden trophies. Vova wants to swap two trophies (not necessarily adjacent ones) to make the arrangemen...
1,600
false
true
false
false
false
false
false
false
false
false
5,314
1184E2
After a successful field test, Heidi is considering deploying a trap along some Corridor, possibly not the first one. She wants to avoid meeting the Daleks inside the Time Vortex, so for abundance of caution she considers placing the traps only along those Corridors that are not going to be used according to the curren...
2,100
false
false
false
false
false
false
false
false
false
true
4,782
1719A
Burenka and Tonya are playing an old Buryat game with a chip on a board of $$$n imes m$$$ cells. At the beginning of the game, the chip is located in the lower left corner of the board. In one move, the player can move the chip to the right or up by any odd number of cells (but you cannot move the chip both to the rig...
800
true
false
false
false
false
false
false
false
false
false
1,968
1869B
Piggy lives on an infinite plane with the Cartesian coordinate system on it. There are $$$n$$$ cities on the plane, numbered from $$$1$$$ to $$$n$$$, and the first $$$k$$$ cities are defined as major cities. The coordinates of the $$$i$$$-th city are $$$(x_i,y_i)$$$. Piggy, as a well-experienced traveller, wants to hav...
1,100
true
false
false
false
false
false
false
false
true
false
1,060
145E
Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya brought home string _s_ with the length of _n_. The string only consists of lucky digits. The...
2,400
false
false
false
false
true
false
false
false
false
false
9,291
1292B
With a new body, our idol Aroma White (or should we call her Kaori Minamiya?) begins to uncover her lost past through the OS space. The space can be considered a 2D plane, with an infinite number of data nodes, indexed from $$$0$$$, with their coordinates defined as follows: The coordinates of the $$$0$$$-th node is $...
1,700
false
true
true
false
false
true
true
false
false
false
4,236
306A
Problem - 306A - Codeforces =============== xa0 . He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the fairest (that is, most equal) manner. He wants to choose such _a__i_, where _a__i_ is the number of candies in the _i_...
800
false
false
true
false
false
false
false
false
false
false
8,611
167C
In some country live wizards. They love playing with numbers. The blackboard has two numbers written on it — _a_ and _b_. The order of the numbers is not important. Let's consider _a_u2009≤u2009_b_ for the sake of definiteness. The players can cast one of the two spells in turns: Replace _b_ with _b_u2009-u2009_a__k_....
2,300
true
false
false
false
false
false
false
false
false
false
9,193
215A
Vasya's bicycle chain drive consists of two parts: _n_ stars are attached to the pedal axle, _m_ stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation. We know that the _i_-th star on the pedal axle has _a__i_ (0u2009<u2009_a_1u2009<u2009_a_2u2009<u2009.....
900
false
false
true
false
false
false
true
false
false
false
8,981
1270C
Let's call an array $$$a_1, a_2, dots, a_m$$$ of nonnegative integer numbers good if $$$a_1 + a_2 + dots + a_m = 2cdot(a_1 oplus a_2 oplus dots oplus a_m)$$$, where $$$oplus$$$ denotes the $$$. At the same time, array $$$[1, 2, 1, 3]$$$ isn't good, as $$$1 + 2 + 1 + 3 = 7 eq 2cdot 1 = 2cdot(1oplus 2 oplus 1 oplus 3)$$...
1,400
true
false
false
false
false
true
false
false
false
false
4,342
750B
In this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of the equator and any meridian is considered to be exactly 40u2009000 kilometers. Thus, travelling from North Pole to South Pole or vice versa takes exactly 20u2009000 kilometers. Limak, a polar bear, lives o...
1,300
false
false
true
false
false
false
false
false
false
false
6,792
1393C
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling. Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat th...
1,700
true
true
false
false
false
true
false
false
true
false
3,705
789A
Anastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she began to collect Uzhlyandian pebbles. At first, she decided to collect all the pebbles she could find in the park. She has only two pockets. She can put at most _k_ pebbles in each pocket at the same time...
1,100
true
false
true
false
false
false
false
false
false
false
6,616
1606E
Problem - 1606E - 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,100
true
false
false
true
false
false
false
false
false
false
2,625
1003D
Polycarp has $$$n$$$ coins, the value of the $$$i$$$-th coin is $$$a_i$$$. It is guaranteed that all the values are integer powers of $$$2$$$ (i.e. $$$a_i = 2^d$$$ for some non-negative integer number $$$d$$$). Polycarp wants to know answers on $$$q$$$ queries. The $$$j$$$-th query is described as integer number $$$b_j...
1,600
false
true
false
false
false
false
false
false
false
false
5,671
704E
Tony Stark is playing a game with his suits (they have auto-pilot now). He lives in Malibu. Malibu has _n_ junctions numbered from 1 to _n_, connected with _n_u2009-u20091 roads. One can get from a junction to any other junction using these roads (graph of Malibu forms a tree). Tony has _m_ suits. There's a special pla...
3,300
false
false
false
false
true
false
false
false
false
false
7,002
1312B
Problem - 1312B - 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
false
false
false
false
false
true
false
false
true
false
4,136
1835C
Famous worldwide astrophysicist Mleil waGrasse Tysok recently read about the existence of twin galaxy clusters. Before he shares this knowledge with the broader audience in his podcast called S.tarT-ok, he wants to prove their presence on his own. Mleil is aware that the vastness of the universe is astounding (almost a...
2,600
true
false
false
false
false
true
true
false
false
false
1,276
1238B
Ivan plays an old action game called Heretic. He's stuck on one of the final levels of this game, so he needs some help with killing the monsters. The main part of the level is a large corridor (so large and narrow that it can be represented as an infinite coordinate line). The corridor is divided into two parts; let's...
1,300
false
true
false
false
false
false
false
false
true
false
4,502
1777B
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array), and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there i...
900
true
true
false
false
false
false
false
false
false
false
1,613
212E
Сity N. has a huge problem with roads, food and IT-infrastructure. In total the city has _n_ junctions, some pairs of them are connected by bidirectional roads. The road network consists of _n_u2009-u20091 roads, you can get from any junction to any other one by these roads. Yes, you're right — the road network forms a...
1,500
false
false
false
true
false
false
false
false
false
false
8,989
936C
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm! Of course, there is a code lock is installed on the safe. The lock ...
2,300
false
false
true
false
false
true
false
false
false
false
5,956
607D
Genos and Saitama went shopping for Christmas trees. However, a different type of tree caught their attention, the exalted Power Tree. A Power Tree starts out as a single root vertex indexed 1. A Power Tree grows through a magical phenomenon known as an update. In an update, a single vertex is added to the tree as a ch...
2,600
false
false
false
false
true
false
false
false
false
false
7,416
1731D
Game studio "DbZ Games" wants to introduce another map in their popular game "Valiant". This time, the map named "Panvel" will be based on the city of Mumbai. Mumbai can be represented as $$$n imes m$$$ cellular grid. Each cell $$$(i, j)$$$ ($$$1 le i le n$$$; $$$1 le j le m$$$) of the grid is occupied by a cuboid bui...
1,700
false
false
false
true
true
false
true
true
false
false
1,902
1864I
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Harbour.Space Scholarship Contest 2023-2024 (Div. 1 + Div. 2) 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 IC...
3,500
false
true
false
false
false
false
false
false
false
true
1,089
2022E2
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 978 (Div. 2) 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...
2,600
false
false
false
false
true
false
false
true
false
true
132
1804D
Annie is an amateur photographer. She likes to take pictures of giant residential buildings at night. She just took a picture of a huge rectangular building that can be seen as a table of $$$n imes m$$$ windows. That means that the building has $$$n$$$ floors and each floor has exactly $$$m$$$ windows. Each window is ...
2,000
false
true
true
true
false
false
true
false
false
false
1,454
359B
Problem - 359B - 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
false
true
false
true
false
false
false
false
8,398
1181A
Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now. Sasha and Masha are about to buy some coconuts which are sold at price $$$z$$$ chizhiks per ...
1,000
true
true
false
false
false
false
false
false
false
false
4,814
1889D
Problem - 1889D - 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 - ...
3,000
false
false
true
false
false
false
true
false
false
true
962
1537C
You are a game designer and want to make an obstacle course. The player will walk from left to right. You have $$$n$$$ heights of mountains already selected and want to arrange them so that the absolute difference of the heights of the first and last mountains is as small as possible. In addition, you want to make the ...
1,200
true
true
true
false
false
true
false
false
false
false
2,960
1701B
Recall that a permutation of length $$$n$$$ is an array where each element from $$$1$$$ to $$$n$$$ occurs exactly once. For a fixed positive integer $$$d$$$, let's define the cost of the permutation $$$p$$$ of length $$$n$$$ as the number of indices $$$i$$$ $$$(1 le i < n)$$$ such that $$$p_i cdot d = p_{i + 1}$$$. For...
800
false
true
false
false
false
false
false
false
false
false
2,075
940F
You come home and fell some unpleasant smell. Where is it coming from? You are given an array _a_. You have to answer the following queries: 1. You are given two integers _l_ and _r_. Let _c__i_ be the number of occurrences of _i_ in _a__l_:u2009_r_, where _a__l_:u2009_r_ is the subarray of _a_ from _l_-th element to _...
2,600
false
false
false
false
true
false
true
false
false
false
5,933
1194C
You are given three strings $$$s$$$, $$$t$$$ and $$$p$$$ consisting of lowercase Latin letters. You may perform any number (possibly, zero) operations on these strings. During each operation you choose any character from $$$p$$$, erase it from $$$p$$$ and insert it into string $$$s$$$ (you may insert this character any...
1,300
false
false
true
false
false
false
false
false
false
false
4,734
868E
You are given a tree (a connected non-oriented graph without cycles) with vertices numbered from 1 to _n_, and the length of the _i_-th edge is _w__i_. In the vertex _s_ there is a policeman, in the vertices _x_1,u2009_x_2,u2009...,u2009_x__m_ (_x__j_u2009≠u2009_s_) _m_ criminals are located. The policeman can walk alo...
2,700
false
false
false
true
false
false
false
false
false
true
6,269
681C
Petya has recently learned data structure named "Binary heap". The heap he is now operating with allows the following operations: put the given number into the heap; get the value of the minimum element in the heap; extract the minimum element from the heap; Thus, at any moment of time the heap contains several inte...
1,600
false
true
false
false
true
true
false
false
false
false
7,101
741E
All of us know that girls in Arpa’s land are... ok, you’ve got the idea :D Anyone knows that Arpa isn't a normal man, he is ... well, sorry, I can't explain it more. Mehrdad is interested about the reason, so he asked Sipa, one of the best biology scientists in Arpa's land, for help. Sipa has a DNA editor. Sipa put Arp...
3,400
false
false
false
false
true
false
false
false
false
false
6,832
1299E
This problem is interactive. We have hidden a permutation $$$p_1, p_2, dots, p_n$$$ of numbers from $$$1$$$ to $$$n$$$ from you, where $$$n$$$ is even. You can try to guess it using the following queries: $$$?$$$ $$$k$$$ $$$a_1$$$ $$$a_2$$$ $$$dots$$$ $$$a_k$$$. In response, you will learn if the average of elements wi...
3,400
true
false
false
false
false
false
false
false
false
false
4,197
958E1
The Rebel fleet is afraid that the Empire might want to strike back again. Princess Heidi needs to know if it is possible to assign _R_ Rebel spaceships to guard _B_ bases so that every base has exactly one guardian and each spaceship has exactly one assigned base (in other words, the assignment is a perfect matching)....
1,600
true
true
false
false
false
false
true
false
false
false
5,883
171H
Problem - 171H - Codeforces =============== xa0 separated by a single space. Output Output two integers separated by a single space. Examples Input 1 0 Output 0 0 Input 2 15 Output 3 0 Input 4 160 Output 12 12
1,700
false
false
true
false
false
false
false
false
false
false
9,179
1444C
The new academic year has started, and Berland's university has $$$n$$$ first-year students. They are divided into $$$k$$$ academic groups, however, some of the groups might be empty. Among the students, there are $$$m$$$ pairs of acquaintances, and each acquaintance pair might be both in a common group or be in two di...
2,500
false
false
false
false
true
false
false
false
false
true
3,452
670D1
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only. Waking up in the m...
1,400
false
false
true
false
false
false
true
true
false
false
7,144
645F
In an attempt to make peace with the Mischievious Mess Makers, Bessie and Farmer John are planning to plant some flower gardens to complement the lush, grassy fields of Bovinia. As any good horticulturist knows, each garden they plant must have the exact same arrangement of flowers. Initially, Farmer John has _n_ diffe...
2,500
true
false
false
false
false
false
false
false
false
false
7,229
183E
The prestigious Codeforces kindergarten consists of _n_ kids, numbered 1 through _n_. Each of them are given allowance in rubles by their parents. Today, they are going to the most famous candy shop in the town. The shop sells candies in packages: for all _i_ between 1 and _m_, inclusive, it sells a package containing ...
2,900
false
true
false
false
false
false
false
false
false
false
9,105
1833F
Ira loves Spanish flamenco dance very much. She decided to start her own dance studio and found $$$n$$$ students, $$$i$$$th of whom has level $$$a_i$$$. Ira can choose several of her students and set a dance with them. So she can set a huge number of dances, but she is only interested in magnificent dances. The dance i...
1,700
true
false
true
false
true
true
false
false
true
false
1,286
1313A
Tired of boring office work, Denis decided to open a fast food restaurant. On the first day he made $$$a$$$ portions of dumplings, $$$b$$$ portions of cranberry juice and $$$c$$$ pancakes with condensed milk. The peculiarity of Denis's restaurant is the procedure of ordering food. For each visitor Denis himself chooses...
900
false
true
true
false
false
false
true
false
false
false
4,130
115C
Little John aspires to become a plumber! Today he has drawn a grid consisting of _n_ rows and _m_ columns, consisting of _n_u2009×u2009_m_ square cells. In each cell he will draw a pipe segment. He can only draw four types of segments numbered from 1 to 4, illustrated as follows: Each pipe segment has two ends, illustr...
2,200
true
false
false
false
false
false
false
false
false
false
9,426
1267F
, # Foolpr¨ uf Security Input file: standard input Output file: standard output Time limit: 3 seconds Memory limit: 512 megabytes Alice and Bob obtained a map of the secret underground facility. The facility consists of n security units and m chemical labs , connected by bidirectional tunnels. The map of this facil...
2,600
false
false
false
false
false
false
false
false
false
true
4,358
176C
Two players play a game. The game is played on a rectangular board with _n_u2009×u2009_m_ squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the same square. The second player aims to stop the first one with a tube of superglue. We'l...
2,000
false
false
false
false
false
true
false
false
false
false
9,157
386C
String diversity is the number of symbols that occur in the string at least once. Diversity of _s_ will be denoted by _d_(_s_). For example , _d_("aaa")=1, _d_("abacaba")=3. Given a string _s_, consisting of lowercase Latin letters. Consider all its substrings. Obviously, any substring diversity is a number from 1 to _...
2,000
false
false
false
true
false
false
false
false
false
false
8,284
1827E
There is a country consisting of $$$n$$$ cities and $$$n - 1$$$ bidirectional roads connecting them such that we can travel between any two cities using these roads. In other words, these cities and roads form a tree. There are $$$m$$$ bus routes connecting the cities together. A bus route between city $$$x$$$ and city...
3,400
false
true
false
false
false
true
false
true
false
false
1,318
1635D
You are given an array $$$a$$$ consisting of $$$n$$$ distinct positive integers. Let's consider an infinite integer set $$$S$$$ which contains all integers $$$x$$$ that satisfy at least one of the following conditions: 1. $$$x = a_i$$$ for some $$$1 leq i leq n$$$. 2. $$$x = 2y + 1$$$ and $$$y$$$ is in $$$S$$$. 3. $$$x...
1,800
true
false
false
true
false
false
false
false
false
false
2,437
1547G
You are given a directed graph $$$G$$$ which can contain loops (edges from a vertex to itself). Multi-edges are absent in $$$G$$$ which means that for all ordered pairs $$$(u, v)$$$ exists at most one edge from $$$u$$$ to $$$v$$$. Vertices are numbered from $$$1$$$ to $$$n$$$. A path from $$$u$$$ to $$$v$$$ is a sequen...
2,100
false
false
false
true
false
false
false
false
false
true
2,907
1996A
Problem - 1996A - 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 - ...
800
true
false
false
false
false
false
false
true
false
false
290