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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6C | Problem - 6C - 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 - sol... | 1,200 | false | true | false | false | false | false | false | false | false | false | 9,963 |
1398G | A running competition is going to be held soon. The stadium where the competition will be held can be represented by several segments on the coordinate plane: two horizontal segments: one connecting the points $$$(0, 0)$$$ and $$$(x, 0)$$$, the other connecting the points $$$(0, y)$$$ and $$$(x, y)$$$; $$$n + 1$$$ ve... | 2,600 | true | false | false | false | false | false | false | false | false | false | 3,680 |
1887C | Given an array $$$a$$$ of length $$$n$$$ consisting of integers. Then the following operation is sequentially applied to it $$$q$$$ times: Choose indices $$$l$$$ and $$$r$$$ ($$$1 le l le r le n$$$) and an integer $$$x$$$; Add $$$x$$$ to all elements of the array $$$a$$$ in the segment $$$[l, r]$$$. More formally, as... | 2,400 | false | true | false | false | true | true | true | true | false | false | 970 |
2005C | Narek is too lazy to create the third problem of this contest. His friend Artur suggests that he should use ChatGPT. ChatGPT creates $$$n$$$ problems, each consisting of $$$m$$$ letters, so Narek has $$$n$$$ strings. To make the problem harder, he combines the problems by selecting some of the $$$n$$$ strings possibly ... | 1,800 | false | false | true | true | false | false | false | false | false | false | 221 |
242D | Valera has _n_ counters numbered from 1 to _n_. Some of them are connected by wires, and each of the counters has a special button. Initially, all the counters contain number 0. When you press a button on a certain counter, the value it has increases by one. Also, the values recorded in all the counters, directly conne... | 2,100 | false | true | false | false | false | false | false | false | false | true | 8,865 |
1970D1 | Professor Vector is preparing to teach her Arithmancy class. She needs to prepare $$$n$$$ distinct magic words for the class. Each magic word is a string consisting of characters X and O. A spell is a string created by concatenating two magic words together. The power of a spell is equal to the number of its different ... | 2,100 | false | false | false | false | false | true | true | false | false | false | 477 |
1685D2 | This is a hard version of the problem. The difference between the easy and hard versions is that in this version, you have to output the lexicographically smallest permutation with the smallest weight. You are given a permutation $$$p_1, p_2, ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$. Let's define the weight of... | 3,500 | false | true | false | false | false | true | false | false | false | false | 2,161 |
1612E | Monocarp is a tutor of a group of $$$n$$$ students. He communicates with them using a conference in a popular messenger. Today was a busy day for Monocarp — he was asked to forward a lot of posts and announcements to his group, that's why he had to write a very large number of messages in the conference. Monocarp knows... | 2,000 | false | true | false | true | false | false | true | false | true | false | 2,579 |
1999G1 | Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 964 (Div. 4) 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,500 | false | false | false | false | false | false | false | true | false | false | 265 |
177E1 | The Smart Beaver from ABBYY plans a space travel on an ultramodern spaceship. During the voyage he plans to visit _n_ planets. For planet _i_ _a__i_ is the maximum number of suitcases that an alien tourist is allowed to bring to the planet, and _b__i_ is the number of citizens on the planet. The Smart Beaver is going t... | 1,700 | false | false | false | false | false | false | false | true | false | false | 9,146 |
952C | Everybody knows of . Remove it and add its height to the end of the output array. Shift the stacks in the row so that there is no gap between them. Repeat the procedure until all stacks have been removed. At first you are very happy with your algorithm, but as you try it on more inputs you realize that it doesn't alway... | 1,600 | false | false | true | false | false | false | false | false | false | false | 5,914 |
1849F | Problem - 1849F - 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,700 | false | true | false | false | true | false | false | true | false | false | 1,183 |
248A | One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house. Karlsson's gaze immediately fell on _n_ wooden... | 800 | false | false | true | false | false | false | false | false | false | false | 8,843 |
814E | Those unwilling to return home from a long journey, will be affected by the oddity of the snail and lose their way. Mayoi, the oddity's carrier, wouldn't like this to happen, but there's nothing to do with this before a cure is figured out. For now, she would only like to know the enormous number of possibilities to be... | 2,600 | false | false | false | true | false | false | false | false | false | true | 6,501 |
1744B | You are given $$$n$$$ of integers $$$a_1, a_2, ldots, a_n$$$. Process $$$q$$$ queries of two types: query of the form "0 $$$x_j$$$": add the value $$$x_j$$$ to all even elements of the array $$$a$$$, query of the form "1 $$$x_j$$$": add the value $$$x_j$$$ to all odd elements of the array $$$a$$$. Note that when proc... | 800 | true | false | true | false | false | false | false | false | false | false | 1,816 |
1303D | You have a bag of size $$$n$$$. Also you have $$$m$$$ boxes. The size of $$$i$$$-th box is $$$a_i$$$, where each $$$a_i$$$ is an integer non-negative power of two. You can divide boxes into two parts of equal size. Your goal is to fill the bag completely. For example, if $$$n = 10$$$ and $$$a = [1, 1, 32]$$$ then you h... | 1,900 | false | true | false | false | false | false | false | false | false | false | 4,175 |
264C | There are _n_ balls. They are arranged in a row. Each ball has a color (for convenience an integer) and an integer value. The color of the _i_-th ball is _c__i_ and the value of the _i_-th ball is _v__i_. Squirrel Liss chooses some balls and makes a new sequence without changing the relative order of the balls. She wan... | 2,000 | false | false | false | true | false | false | false | false | false | false | 8,776 |
1919E | There is a hidden array $$$a$$$ of size $$$n$$$ consisting of only $$$1$$$ and $$$-1$$$. Let $$$p$$$ be the prefix sums of array $$$a$$$. More formally, $$$p$$$ is an array of length $$$n$$$ defined as $$$p_i = a_1 + a_2 + ldots + a_i$$$. Afterwards, array $$$p$$$ is sorted in non-decreasing order. For example, if $$$a... | 2,600 | true | false | true | true | false | true | false | false | false | false | 777 |
1949E | You just created a new character in your favourite role-playing game and now have to decide how to skill him. The two skill attributes to be chosen are: damage per hit and hits per second. Damage per hit is the amount of damage you deal with a single hit, while hits per second is the number of hits you can make in one ... | 2,900 | true | false | false | false | false | false | true | false | false | false | 588 |
1791E | Problem - 1791E - 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 | true | false | true | false | false | false | false | true | false | 1,531 |
1641C | In the work of a doctor, it is important to maintain the anonymity of clients and the results of tests. The test results are sent to everyone personally by email, but people are very impatient and they want to know the results right away. That's why in the testing lab "De-vitro" doctors came up with an experimental way... | 2,200 | false | true | false | false | true | false | true | true | true | false | 2,407 |
1468G | The hobbits Frodo and Sam are carrying the One Ring to Mordor. In order not to be spotted by orcs, they decided to go through the mountains. The mountain relief can be represented as a polyline with $$$n$$$ points $$$(x_i, y_i)$$$, numbered from $$$1$$$ to $$$n$$$ ($$$x_i < x_{i + 1}$$$ for $$$1 le i le n - 1$$$). Hobb... | 2,500 | false | false | false | false | false | false | false | true | false | false | 3,346 |
578A | Problem - 578A - Codeforces =============== xa0 ]( "Codeforces Round #320 u2009–u2009(_x_,u2009_x_)u2009–u2009(2_x_,u20090)u2009–u2009(3_x_,u2009_x_)u2009–u2009(4_x_,u20090)u2009–u2009...u2009-u2009(2_kx_,u20090)u2009–u2009(2_kx_u2009+u2009_x_,u2009_x_)u2009–u2009.... We know that the polyline passes through ... | 1,700 | true | false | false | false | false | false | false | false | false | false | 7,536 |
1685C | Alina has a bracket sequence $$$s$$$ of length $$$2n$$$, consisting of $$$n$$$ opening brackets '(' and $$$n$$$ closing brackets ')'. As she likes balance, she wants to turn this bracket sequence into a balanced bracket sequence. In one operation, she can reverse any substring of $$$s$$$. What's the smallest number of ... | 2,600 | false | true | false | false | false | true | true | false | false | false | 2,163 |
1707E | You are given an integer array $$$a_1,ldots, a_n$$$, where $$$1le a_i le n$$$ for all $$$i$$$. There's a "replace" function $$$f$$$ which takes a pair of integers $$$(l, r)$$$, where $$$l le r$$$, as input and outputs the pair $$$$$$fbig( (l, r) big)=left(min{a_l,a_{l+1},ldots,a_r},, max{a_l,a_{l+1},ldots,a_r} ight).$$... | 3,500 | false | false | false | false | true | false | false | true | false | false | 2,030 |
1932C | You are given an array $$$a$$$ of length $$$n$$$, a positive integer $$$m$$$, and a string of commands of length $$$n$$$. Each command is either the character 'L' or the character 'R'. Process all $$$n$$$ commands in the order they are written in the string $$$s$$$. Processing a command is done as follows: First, outp... | 1,400 | true | false | true | false | true | false | true | false | false | false | 692 |
792F | Vova plays a computer game known as Mages and Monsters. Vova's character is a mage. Though as he has just started, his character knows no spells. Vova's character can learn new spells during the game. Every spell is characterized by two values _x__i_ and _y__i_ — damage per second and mana cost per second, respectively... | 3,100 | false | false | false | false | true | false | false | false | false | false | 6,608 |
1990E1 | This is the easy version of the problem. The only difference is the limit on the number of queries. This is an interactive problem. You are given a tree of $$$n$$$ nodes with node $$$1$$$ as its root node. There is a hidden mole in one of the nodes. To find its position, you can pick an integer $$$x$$$ ($$$1 le x le n$... | 2,500 | false | false | false | false | true | false | false | true | false | false | 331 |
159D | Problem - 159D - Codeforces =============== xa0 such that 1u2009≤u2009_a_u2009≤u2009_b_u2009<u2009_x_u2009≤u2009_y_u2009≤u2009_s_ and substrings _s_ | 1,500 | false | false | false | true | false | false | true | false | false | false | 9,237 |
63C | The "Bulls and Cows" game needs two people to play. The thinker thinks of a number and the guesser tries to guess it. The thinker thinks of a four-digit number in the decimal system. All the digits in the number are different and the number may have a leading zero. It can't have more than one leading zero, because all ... | 1,700 | false | false | true | false | false | false | true | false | false | false | 9,658 |
955C | Problem - 955C - 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 | true | false | false | false | false | false | false | true | false | false | 5,898 |
1974G | You can never buy enough happiness, so here we go again! In this version, you can only buy $$$h_i = 1$$$ unit of happiness each month, but the number of months is hugely increased. We are in the realm of quantum happiness and time dilation. Being a physicist, Charlie likes to plan his life in simple and precise terms. ... | 2,000 | false | true | false | false | true | false | false | false | true | false | 443 |
442D | When Adam gets a rooted tree (connected non-directed graph without cycles), he immediately starts coloring it. More formally, he assigns a color to each edge of the tree so that it meets the following two conditions: There is no vertex that has more than two incident edges painted the same color. For any two vertexes... | 2,600 | false | false | false | false | true | false | false | false | false | false | 8,067 |
2027B | Stalin Sort is a humorous sorting algorithm designed to eliminate elements which are out of place instead of bothering to sort them properly, lending itself to an $$$mathcal{O}(n)$$$ time complexity. It goes as follows: starting from the second element in the array, if it is strictly smaller than the previous element (... | 1,100 | false | true | false | false | false | false | true | false | false | false | 109 |
1487E | Ivan wants to have a good dinner. A good dinner should consist of a first course, a second course, a drink, and a dessert. There are $$$n_1$$$ different types of first courses Ivan can buy (the $$$i$$$-th of them costs $$$a_i$$$ coins), $$$n_2$$$ different types of second courses (the $$$i$$$-th of them costs $$$b_i$$$... | 2,000 | false | true | true | false | true | false | true | false | true | true | 3,242 |
1221F | Petya recently found a game "Choose a Square". In this game, there are $$$n$$$ points numbered from $$$1$$$ to $$$n$$$ on an infinite field. The $$$i$$$-th point has coordinates $$$(x_i, y_i)$$$ and cost $$$c_i$$$. You have to choose a square such that its sides are parallel to coordinate axes, the lower left and upper... | 2,400 | false | false | false | false | true | false | false | true | true | false | 4,561 |
1666I | This is an interactive problem. There is a grid of $$$n imes m$$$ cells. Two treasure chests are buried in two different cells of the grid. Your task is to find both of them. You can make two types of operations: DIG $$$r$$$ $$$c$$$: try to find the treasure in the cell $$$(r, c)$$$. The interactor will tell you if yo... | 2,200 | true | false | false | false | false | true | true | false | false | false | 2,277 |
1744E2 | This is an hard version of the problem. The only difference between an easy and a hard version is the constraints on $$$a$$$, $$$b$$$, $$$c$$$ and $$$d$$$. You are given $$$4$$$ positive integers $$$a$$$, $$$b$$$, $$$c$$$, $$$d$$$ with $$$a < c$$$ and $$$b < d$$$. Find any pair of numbers $$$x$$$ and $$$y$$$ that satis... | 1,900 | true | false | false | false | false | false | true | false | false | false | 1,812 |
2029E | For two integers $$$x$$$ and $$$y$$$ ($$$x,yge 2$$$), we will say that $$$x$$$ is a generator of $$$y$$$ if and only if $$$x$$$ can be transformed to $$$y$$$ by performing the following operation some number of times (possibly zero): Choose a divisor $$$d$$$ ($$$dge 2$$$) of $$$x$$$, then increase $$$x$$$ by $$$d$$$. ... | 2,100 | true | false | false | false | false | true | true | false | false | false | 93 |
549G | Do you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this summer day a large queue of _n_ Berland residents lined up in front of the ice cream stall. We know that each of them has a certain amount of berland dollars with them. The residents of Berland are nice people,... | 2,200 | false | true | false | false | false | true | false | false | true | false | 7,639 |
1649B | Daniel is watching a football team playing a game during their training session. They want to improve their passing skills during that session. The game involves $$$n$$$ players, making multiple passes towards each other. Unfortunately, since the balls were moving too fast, after the session Daniel is unable to know ho... | 1,300 | false | true | true | false | false | false | false | false | false | false | 2,376 |
1462D | Polycarp was given an array of $$$a[1 dots n]$$$ of $$$n$$$ integers. He can perform the following operation with the array $$$a$$$ no more than $$$n$$$ times: Polycarp selects the index $$$i$$$ and adds the value $$$a_i$$$ to one of his choice of its neighbors. More formally, Polycarp adds the value of $$$a_i$$$ to $... | 1,400 | true | true | false | false | false | false | false | false | false | false | 3,377 |
432D | Problem - 432D - 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,000 | false | false | false | true | false | false | false | false | false | false | 8,111 |
749E | You are given a permutation of integers from 1 to _n_. Exactly once you apply the following operation to this permutation: pick a random segment and shuffle its elements. Formally: 1. Pick a random segment (continuous subsequence) from _l_ to _r_. All segments are equiprobable. 2. Let _k_u2009=u2009_r_u2009-u2009_l_u20... | 2,400 | false | false | false | false | true | false | false | false | false | false | 6,794 |
625B | A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000. This new device is equipped with specially designed artificial intelligence (AI). Employees of Pinea... | 1,200 | false | true | false | false | false | true | false | false | false | false | 7,332 |
1704B | Luke likes to eat. There are $$$n$$$ piles of food aligned in a straight line in front of him. The $$$i$$$-th pile contains $$$a_i$$$ units of food. Luke will walk from the $$$1$$$-st pile towards the $$$n$$$-th pile, and he wants to eat every pile of food without walking back. When Luke reaches the $$$i$$$-th pile, he... | 1,000 | false | true | true | false | false | false | true | false | false | false | 2,054 |
1270H | Suppose that we have an array of $$$n$$$ distinct numbers $$$a_1, a_2, dots, a_n$$$. Let's build a graph on $$$n$$$ vertices as follows: for every pair of vertices $$$i < j$$$ let's connect $$$i$$$ and $$$j$$$ with an edge, if $$$a_i < a_j$$$. Let's define weight of the array to be the number of connected components in... | 3,300 | false | false | false | false | true | false | false | false | false | false | 4,337 |
33A | In one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that while eating one crucian she uses only one row of her teeth, the rest of the teeth are "relaxing". F... | 1,200 | false | true | true | false | false | false | false | false | false | false | 9,833 |
1525C | There are $$$n$$$ robots driving along an OX axis. There are also two walls: one is at coordinate $$$0$$$ and one is at coordinate $$$m$$$. The $$$i$$$-th robot starts at an integer coordinate $$$x_i~(0 < x_i < m)$$$ and moves either left (towards the $$$0$$$) or right with the speed of $$$1$$$ unit per second. No two ... | 2,000 | false | true | true | false | true | false | false | false | true | false | 3,040 |
724F | Problem - 724F - 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,700 | false | false | false | true | false | false | false | false | false | false | 6,909 |
2041K | Image generated by ChatGPT 4o. In an interdisciplinary collaboration, an ecosystem scientist and a computer scientist join forces to analyze the structure of a complex ecosystem using computational methods. The ecosystem scientist models the ecosystem as a directed graph $$$D = (V, A)$$$, where each species is represen... | 3,100 | false | false | false | false | false | false | true | true | false | true | 3 |
774L | Polycarp's workday lasts exactly $$$n$$$ minutes. He loves chocolate bars and can eat one bar in one minute. Today Polycarp has $$$k$$$ bars at the beginning of the workday. In some minutes of the workday Polycarp has important things to do and in such minutes he is not able to eat a chocolate bar. In other minutes he ... | 2,000 | false | false | false | false | false | false | false | true | false | false | 6,670 |
1205B | Problem - 1205B - 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,900 | false | false | false | false | false | false | true | false | false | true | 4,668 |
799D | In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy extensions for his field, each extension enlarges one of the field sizes in a particular number of times. Formally, there are _n_ extensions, the _i_-th of them multiplies the width or the length (b... | 2,100 | false | false | false | true | false | false | true | false | false | false | 6,573 |
1879C | You are given a binary string $$$s$$$. A binary string is a string consisting of characters 0 and/or 1. You can perform the following operation on $$$s$$$ any number of times (even zero): choose an integer $$$i$$$ such that $$$1 le i le s$$$, then erase the character $$$s_i$$$. You have to make $$$s$$$ alternating, i.... | 1,300 | false | true | false | true | false | false | false | false | false | false | 1,008 |
1919F2 | This is the hard version of the problem. The only difference between the two versions is the constraint on $$$c_i$$$ and $$$z$$$. You can make hacks only if both versions of the problem are solved. There are three arrays $$$a$$$, $$$b$$$ and $$$c$$$. $$$a$$$ and $$$b$$$ have length $$$n$$$ and $$$c$$$ has length $$$n-1... | 2,800 | false | true | false | true | true | false | false | false | false | false | 775 |
1551D2 | The only difference between this problem and D1 is that you don't have to provide the way to construct the answer in D1, but you have to do it in this problem. There's a table of $$$n imes m$$$ cells ($$$n$$$ rows and $$$m$$$ columns). The value of $$$n cdot m$$$ is even. A domino is a figure that consists of two cell... | 2,100 | true | false | true | false | false | true | false | false | false | false | 2,887 |
11E | Jack has become a soldier now. Unfortunately, he has trouble with the drill. Instead of marching beginning with the left foot and then changing legs with each step, as ordered, he keeps repeating a sequence of steps, in which he sometimes makes the wrong steps or — horror of horrors! — stops for a while. For example, i... | 2,800 | false | true | false | true | false | false | false | true | false | false | 9,936 |
1009E | Leha is planning his journey from Moscow to Saratov. He hates trains, so he has decided to get from one city to another by car. The path from Moscow to Saratov can be represented as a straight line (well, it's not that straight in reality, but in this problem we will consider it to be straight), and the distance betwee... | 2,000 | true | false | false | false | false | false | false | false | false | false | 5,638 |
369A | Valera is a lazy student. He has _m_ clean bowls and _k_ clean plates. Valera has made an eating plan for the next _n_ days. As Valera is lazy, he will eat exactly one dish per day. At that, in order to eat a dish, he needs exactly one clean plate or bowl. We know that Valera can cook only two types of dishes. He can e... | 900 | false | true | true | false | false | false | false | false | false | false | 8,358 |
1942D | Elsie is learning how to paint. She has a canvas of $$$n$$$ cells numbered from $$$1$$$ to $$$n$$$ and can paint any (potentially empty) subset of cells. Elsie has a 2D array $$$a$$$ which she will use to evaluate paintings. Let the maximal contiguous intervals of painted cells in a painting be $$$[l_1,r_1],[l_2,r_2],l... | 2,100 | false | true | true | true | true | false | false | true | true | false | 628 |
39D | Problem - 39D - 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... | 1,100 | true | false | false | false | false | false | false | false | false | false | 9,797 |
418D | The Finals of the "Russian Code Cup" 2214 will be held in _n_ hotels. Two hotels (let's assume that they are the main hotels), will host all sorts of events, and the remaining hotels will accommodate the participants. The hotels are connected by _n_u2009-u20091 roads, you can get from any hotel to any other one. The or... | 2,800 | false | false | false | false | true | false | false | false | false | true | 8,152 |
1508E | Yuu Koito and Touko Nanami are newlyweds! On the wedding day, Yuu gifted Touko a directed tree with $$$n$$$ nodes and rooted at $$$1$$$, and a labeling $$$a$$$ which is some DFS order of the tree. Every edge in this tree is directed away from the root. After calling dfs(1) the following algorithm returns $$$a$$$ as a D... | 3,100 | false | false | false | false | true | true | true | false | true | false | 3,132 |
110B | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya recently learned to determine whether a string of lowercase Latin letters is lucky. For each in... | 1,100 | false | false | false | false | false | true | false | false | false | false | 9,443 |
1610C | Keshi is throwing a party and he wants everybody in the party to be happy. He has $$$n$$$ friends. His $$$i$$$-th friend has $$$i$$$ dollars. If you invite the $$$i$$$-th friend to the party, he will be happy only if at most $$$a_i$$$ people in the party are strictly richer than him and at most $$$b_i$$$ people are str... | 1,600 | false | true | false | false | false | false | false | true | false | false | 2,598 |
1770C | Joi has an array $$$a$$$ of $$$n$$$ positive integers. Koxia wants you to determine whether there exists a positive integer $$$x > 0$$$ such that $$$gcd(a_i+x,a_j+x)=1$$$ for all $$$1 leq i < j leq n$$$. Here $$$gcd(y, z)$$$ denotes the — the number of test cases. The description of test cases follows. The first line o... | 1,700 | true | false | false | false | false | false | true | false | false | false | 1,675 |
265B | Problem - 265B - 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,000 | false | true | true | false | false | false | false | false | false | false | 8,772 |
1337B | Kana was just an ordinary high school girl before a talent scout discovered her. Then, she became an idol. But different from the stereotype, she is also a gameholic. One day Kana gets interested in a new adventure game called Dragon Quest. In this game, her quest is to beat a dragon. xa0The dragon has a hit point of $... | 900 | true | true | true | false | false | false | false | false | false | false | 4,015 |
2004E | Problem - 2004E - 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 | false | false | false | true | false | false | false | 227 |
1910C | The first location in the brand new critically acclaimed fantasy action RPG "Ancient Staff" is a poisonous swamp. The swamp has some lily pads growing in it. It can be represented as a $$$2 imes n$$$ grid ($$$2$$$ rows and $$$n$$$ columns), where each cell is either empty or has a lily pad in it. There are exactly $$$... | 1,600 | false | false | true | false | false | false | false | false | false | false | 845 |
928B | There are times you recall a good old friend and everything you've come through together. Luckily there are social networksxa0— they store all your message history making it easy to know what you argued over 10 years ago. More formal, your message history is a sequence of messages ordered by time sent numbered from 1 t... | 1,400 | false | false | false | true | false | false | false | false | false | false | 5,993 |
1392A | Lord Omkar has permitted you to enter the Holy Church of Omkar! To test your worthiness, Omkar gives you a password which you must interpret! A password is an array $$$a$$$ of $$$n$$$ positive integers. You apply the following operation to the array: pick any two adjacent numbers that are not equal to each other and re... | 800 | true | true | false | false | false | false | false | false | false | false | 3,716 |
64H | Problem - 64H - Codeforces =============== xa0 and by the name lexicographically in the case of a tie. Places are numerated from 1. If more than one participant has some score, all of them share the places and you should output something like "12-14 john". Please, look into the samples for clarification. Inpu... | 2,300 | false | false | false | false | false | false | false | false | true | false | 9,648 |
1688B | She is skilled in all kinds of magics, and is keen on inventing new one. —Perfect Memento in Strict Sense Patchouli is making a magical talisman. She initially has $$$n$$$ magical tokens. Their magical power can be represented with positive integers $$$a_1, a_2, ldots, a_n$$$. Patchouli may perform the following two op... | 800 | false | true | false | false | false | true | false | false | true | false | 2,150 |
51C | The New Vasjuki village is stretched along the motorway and that's why every house on it is characterized by its shift relative to some fixed point — the _x__i_ coordinate. The village consists of _n_ houses, the _i_-th house is located in the point with coordinates of _x__i_. TELE3, a cellular communication provider p... | 1,800 | false | true | false | false | false | false | false | true | false | false | 9,717 |
100G | The famous singer, Aryo, is going to publish a new album of his great work! Unfortunately these days, there are many albums, Aryo wants to choose a new name for his album, a name that has not been used or at least has not been used recently. He has a list of all used album names together with the year the albums were p... | 1,800 | false | false | true | false | true | false | false | false | false | false | 9,483 |
958A1 | The stardate is 1977 and the science and art of detecting Death Stars is in its infancy. Princess Heidi has received information about the stars in the nearby solar system from the Rebel spies and now, to help her identify the exact location of the Death Star, she needs to know whether this information is correct. Two ... | 1,400 | false | false | true | false | false | false | false | false | false | false | 5,893 |
773A | You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made _y_ submissions, out of which _x_ have been successful. Thus, your current success rate on Codeforces is equal to _x_u2009/u2009_y_. Your favorite rational number in the [0;1] range is _p_u2009/u2009_q_. No... | 1,700 | true | false | false | false | false | false | false | true | false | false | 6,687 |
1771D | Hossam has an unweighted tree $$$G$$$ with letters in vertices. Hossam defines $$$s(v, , u)$$$ as a string that is obtained by writing down all the letters on the unique simple path from the vertex $$$v$$$ to the vertex $$$u$$$ in the tree $$$G$$$. A string $$$a$$$ is a subsequence of a string $$$s$$$ if $$$a$$$ can be... | 2,100 | false | false | false | true | true | false | true | false | false | false | 1,666 |
2014C | In Sherwood, we judge a man not by his wealth, but by his merit. Look around, the rich are getting richer, and the poor are getting poorer. We need to take from the rich and give to the poor. We need Robin Hood! There are $$$n$$$ people living in the town. Just now, the wealth of the $$$i$$$-th person was $$$a_i$$$ gol... | 1,100 | true | true | false | false | false | false | false | true | false | false | 169 |
1130B | Sasha and Dima want to buy two $$$n$$$-tier cakes. Each cake should consist of $$$n$$$ different tiers: from the size of $$$1$$$ to the size of $$$n$$$. Tiers should go in order from the smallest to the biggest (from top to bottom). They live on the same street, there are $$$2 cdot n$$$ houses in a row from left to rig... | 1,200 | false | true | false | false | false | false | false | false | false | false | 5,070 |
1375A | # Sign Flipping Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes You are given n integers a1, a 2, . . . , a n, where n is odd . You are allowed to flip the sign of some (possibly all or none) of them. You wish to perform these flips in such a way that the foll... | 1,100 | true | false | false | false | false | true | false | false | false | false | 3,787 |
369E | Valera loves segments. He has recently come up with one interesting problem. The _Ox_ axis of coordinates has _n_ segments, the _i_-th segment starts in position _l__i_ and ends in position _r__i_ (we will mark it as [_l__i_,u2009_r__i_]). Your task is to process _m_ queries, each consists of number _cnt__i_ and a set ... | 2,200 | false | false | false | false | true | false | false | true | false | false | 8,354 |
10B | All cinema halls in Berland are rectangles with _K_ rows of _K_ seats each, and _K_ is an odd number. Rows and seats are numbered from 1 to _K_. For safety reasons people, who come to the box office to buy tickets, are not allowed to choose seats themselves. Formerly the choice was made by a cashier, but now this is th... | 1,500 | false | false | true | true | false | false | false | false | false | false | 9,944 |
952A | 800 | true | false | false | false | false | false | false | false | false | false | 5,916 | |
1693C | AmShZ has traveled to Italy from Iran for the Thom Yorke concert. There are $$$n$$$ cities in Italy indexed from $$$1$$$ to $$$n$$$ and $$$m$$$ directed roads indexed from $$$1$$$ to $$$m$$$. Initially, Keshi is located in the city $$$1$$$ and wants to go to AmShZ's house in the city $$$n$$$. Since Keshi doesn't know t... | 2,300 | false | true | false | false | false | false | false | false | false | true | 2,120 |
1996C | You are given two strings $$$a$$$ and $$$b$$$ of length $$$n$$$. Then, you are (forced against your will) to answer $$$q$$$ queries. For each query, you are given a range bounded by $$$l$$$ and $$$r$$$. In one operation, you can choose an integer $$$i$$$ ($$$l leq i leq r$$$) and set $$$a_i = x$$$ where $$$x$$$ is any ... | 1,200 | false | true | false | true | false | false | false | false | true | false | 288 |
1315C | Problem - 1315C - 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,200 | false | true | false | false | false | false | false | false | false | false | 4,122 |
1242B | Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph. It is an undirected weighted graph on $$$n$$$ vertices. It is a complete graph: each pair of vertices is ... | 1,900 | false | false | false | false | false | false | false | false | true | true | 4,488 |
283C | In the Isle of Guernsey there are _n_ different types of coins. For each _i_ (1u2009≤u2009_i_u2009≤u2009_n_), coin of type _i_ is worth _a__i_ cents. It is possible that _a__i_u2009=u2009_a__j_ for some _i_ and _j_ (_i_u2009≠u2009_j_). Bessie has some set of these coins totaling _t_ cents. She tells Jessie _q_ pairs of... | 2,100 | false | false | false | true | false | false | false | false | false | false | 8,701 |
1333C | Eugene likes working with arrays. And today he needs your help in solving one challenging task. An array $$$c$$$ is a subarray of an array $$$b$$$ if $$$c$$$ can be obtained from $$$b$$$ by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.... | 1,700 | false | false | true | false | true | false | false | true | false | false | 4,041 |
1015E1 | A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $$$0$$$ are not allowed). Let's con... | 1,700 | false | true | false | true | false | false | true | false | false | false | 5,615 |
1980A | Vlad is planning to hold $$$m$$$ rounds next month. Each round should contain one problem of difficulty levels 'A', 'B', 'C', 'D', 'E', 'F', and 'G'. Vlad already has a bank of $$$n$$$ problems, where the $$$i$$$-th problem has a difficulty level of $$$a_i$$$. There may not be enough of these problems, so he may have t... | 800 | true | false | false | false | false | false | false | false | false | false | 410 |
1943D2 | This is the hard version of the problem. The only difference between the two versions is the constraint on $$$n$$$. You can make hacks only if both versions of the problem are solved. An array $$$b$$$ of $$$m$$$ non-negative integers is said to be good if all the elements of $$$b$$$ can be made equal to $$$0$$$ using t... | 2,800 | false | false | false | true | false | false | false | false | false | false | 619 |
20B | Problem - 20B - 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,000 | true | false | false | false | false | false | false | false | false | false | 9,894 |
5B | Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product. You are to implement the alignment in the shortest possible time. Good luck! Input The input file cons... | 1,200 | false | false | true | false | false | false | false | false | false | false | 9,969 |
2025D | Imagine a game where you play as a character that has two attributes: "Strength" and "Intelligence", that are at zero level initially. During the game, you'll acquire $$$m$$$ attribute points that allow you to increase your attribute levelsxa0— one point will increase one of the attributes by one level. But sometimes, ... | 1,800 | true | false | true | true | true | false | true | false | false | false | 120 |
644C | There are some websites that are accessible through several different addresses. For example, for a long time Codeforces was accessible with two hostnames codeforces.com and codeforces.ru. You are given a list of page addresses being queried. For simplicity we consider all addresses to have the form where: <hostname>x... | 2,100 | false | false | true | false | true | false | false | true | true | false | 7,235 |
223B | Problem - 223B - 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 | false | false | false | 8,946 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.