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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1788F | You are given a tree of $$$n$$$ vertices. The vertices are numbered from $$$1$$$ to $$$n$$$. You will need to assign a weight to each edge. Let the weight of the $$$i$$$-th edge be $$$a_i$$$ ($$$1 leq i leq n-1$$$). The weight of each edge should be an integer between $$$0$$$ and $$$2^{30}-1$$$, inclusive. You are give... | 2,500 | false | true | true | false | false | true | false | false | false | true | 1,549 |
776D | Moriarty has trapped _n_ people in _n_ distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are _m_ switches. Each switch control doors of some rooms, but each door is control... | 2,000 | false | false | false | false | false | false | false | false | false | true | 6,665 |
1859C | Andrey is just starting to come up with problems, and it's difficult for him. That's why he came up with a strange problem about permutations$$$^{dagger}$$$ and asks you to solve it. Can you do it? Let's call the cost of a permutation $$$p$$$ of length $$$n$$$ the value of the expression: $$$(sum_{i = 1}^{n} p_i cdot i... | 1,200 | true | true | false | true | false | false | true | false | false | false | 1,129 |
920G | Problem - 920G - 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,200 | true | false | false | false | false | false | true | true | false | false | 6,044 |
1437F | $$$n$$$ fishermen have just returned from a fishing vacation. The $$$i$$$-th fisherman has caught a fish of weight $$$a_i$$$. Fishermen are going to show off the fish they caught to each other. To do so, they firstly choose an order in which they show their fish (each fisherman shows his fish exactly once, so, formally... | 2,600 | true | false | false | true | false | false | false | false | false | false | 3,480 |
365A | Problem - 365A - 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,100 | false | false | true | false | false | false | false | false | false | false | 8,372 |
1352B | You are given two positive integers $$$n$$$ ($$$1 le n le 10^9$$$) and $$$k$$$ ($$$1 le k le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$). In other words, find $$$a_1, a_2, ldots, a_k$$$ such that all $$$a_i>0$$$, $$$n... | 1,200 | true | false | false | false | false | true | false | false | false | false | 3,951 |
1338C | Consider the infinite sequence $$$s$$$ of positive integers, created by repeating the following steps: 1. Find the lexicographically smallest triple of positive integers $$$(a, b, c)$$$ such that $$$a oplus b oplus c = 0$$$, where $$$oplus$$$ denotes the $$$ is considered to be lexicographically smaller than triple $$... | 2,200 | true | false | false | false | false | true | true | false | false | false | 4,012 |
1881C | Kristina has a matrix of size $$$n$$$ by $$$n$$$, filled with lowercase Latin letters. The value of $$$n$$$ is even. She wants to change some characters so that her matrix becomes a perfect square. A matrix is called a perfect square if it remains unchanged when rotated $$$90^circ$$$ clockwise once. Here is an example ... | 1,200 | false | false | true | false | false | false | true | false | false | false | 1,002 |
379A | Problem - 379A - Codeforces =============== xa0 . Output Print a single integer β the number of hours Vasily can light up the room for. Examples Input 4 2 Output 7 Input 6 3 Output 8 Note Consider the first sample. For the first four hours Vasily lights up new candles, then he uses four burned out can... | 1,000 | false | false | true | false | false | false | false | false | false | false | 8,317 |
461B | Appleman has a tree with _n_ vertices. Some of the vertices (at least one) are colored black and other vertices are colored white. Consider a set consisting of _k_ (0u2009β€u2009_k_u2009<u2009_n_) edges of Appleman's tree. If Appleman deletes these edges from the tree, then it will split into (_k_u2009+u20091) parts. No... | 2,000 | false | false | false | true | false | false | false | false | false | false | 7,995 |
1726A | Mainak has an array $$$a_1, a_2, ldots, a_n$$$ of $$$n$$$ positive integers. He will do the following operation to this array exactly once: Pick a subsegment of this array and cyclically rotate it by any amount. Formally, he can do the following exactly once: Pick two integers $$$l$$$ and $$$r$$$, such that $$$1 le l... | 900 | true | true | false | false | false | false | false | false | false | false | 1,933 |
1510H | Problem - 1510H - 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,200 | false | false | false | true | false | false | false | false | false | false | 3,120 |
894A | Problem - 894A - 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 | false | true | false | false | true | false | false | false | 6,175 |
1227B | Permutation $$$p$$$ is a sequence of integers $$$p=[p_1, p_2, dots, p_n]$$$, consisting of $$$n$$$ distinct (unique) positive integers between $$$1$$$ and $$$n$$$, inclusive. For example, the following sequences are permutations: $$$[3, 4, 1, 2]$$$, $$$[1]$$$, $$$[1, 2]$$$. The following sequences are not permutations:... | 1,200 | false | false | false | false | false | true | false | false | false | false | 4,543 |
1380E | You have a set of $$$n$$$ discs, the $$$i$$$-th disc has radius $$$i$$$. Initially, these discs are split among $$$m$$$ towers: each tower contains at least one disc, and the discs in each tower are sorted in descending order of their radii from bottom to top. You would like to assemble one tower containing all of thos... | 2,300 | false | false | true | false | true | false | false | false | false | false | 3,767 |
264B | Problem - 264B - 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,500 | false | false | false | true | false | false | false | false | false | false | 8,777 |
650B | Vasya's telephone contains _n_ photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, you reach photo _n_. Similarly, by swiping right from the last photo you reach photo 1. It takes _... | 1,900 | false | false | false | true | false | false | true | true | false | false | 7,216 |
1693E | Yeri has an array of $$$n + 2$$$ non-negative integers : $$$a_0, a_1, ..., a_n, a_{n + 1}$$$. We know that $$$a_0 = a_{n + 1} = 0$$$. She wants to make all the elements of $$$a$$$ equal to zero in the minimum number of operations. In one operation she can do one of the following: Choose the leftmost maximum element an... | 3,400 | false | true | false | false | true | false | false | false | false | false | 2,118 |
387C | George is a cat, so he really likes to play. Most of all he likes to play with his array of positive integers _b_. During the game, George modifies the array by using special changes. Let's mark George's current array as _b_1,u2009_b_2,u2009...,u2009_b__b_ (record _b_ denotes the current length of the array). Then one ... | 1,700 | false | true | true | false | false | false | false | false | false | false | 8,280 |
161B | One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape... | 1,700 | false | true | false | false | false | true | false | false | true | false | 9,229 |
1451F | Jeel and Ashish play a game on an $$$n imes m$$$ matrix. The rows are numbered $$$1$$$ to $$$n$$$ from top to bottom and the columns are numbered $$$1$$$ to $$$m$$$ from left to right. They play turn by turn. Ashish goes first. Initially, each cell of the matrix contains a non-negative integer. Each turn, a player mus... | 2,700 | false | false | false | false | false | true | false | false | false | false | 3,422 |
1574F | A subarray of array $$$a$$$ from index $$$l$$$ to the index $$$r$$$ is the array $$$[a_l, a_{l+1}, dots, a_{r}]$$$. The number of occurrences of the array $$$b$$$ in the array $$$a$$$ is the number of subarrays of $$$a$$$ such that they are equal to $$$b$$$. You are given $$$n$$$ arrays $$$A_1, A_2, dots, A_n$$$; the e... | 2,700 | false | false | false | true | false | false | false | false | false | true | 2,769 |
1439D | Today is the final contest of INOI (Iranian National Olympiad in Informatics). The contest room is a row with $$$n$$$ computers. All computers are numbered with integers from $$$1$$$ to $$$n$$$ from left to right. There are $$$m$$$ participants, numbered with integers from $$$1$$$ to $$$m$$$. We have an array $$$a$$$ o... | 3,100 | false | false | false | true | false | false | false | false | false | false | 3,468 |
1077D | You are given an array $$$s$$$ consisting of $$$n$$$ integers. You have to find any array $$$t$$$ of length $$$k$$$ such that you can cut out maximum number of copies of array $$$t$$$ from array $$$s$$$. Cutting out the copy of $$$t$$$ means that for each element $$$t_i$$$ of array $$$t$$$ you have to find $$$t_i$$$ in... | 1,600 | false | false | false | false | false | false | false | true | true | false | 5,334 |
402B | The Queen of England has _n_ trees growing in a row in her garden. At that, the _i_-th (1u2009β€u2009_i_u2009β€u2009_n_) tree from the left has height _a__i_ meters. Today the Queen decided to update the scenery of her garden. She wants the trees' heights to meet the condition: for all _i_ (1u2009β€u2009_i_u2009<u2009_n_)... | 1,400 | false | false | true | false | false | false | true | false | false | false | 8,216 |
649D | Statement is not available on English language ΠΠ°ΠΌΡΡΡ ΠΊΠΎΠΌΠΏΡΡΡΠ΅ΡΠ° ΡΠΎΡΡΠΎΠΈΡ ΠΈΠ· _n_ ΡΡΠ΅Π΅ΠΊ, ΠΊΠΎΡΠΎΡΡΠ΅ Π²ΡΡΡΡΠΎΠ΅Π½Ρ Π² ΡΡΠ΄. ΠΡΠΎΠ½ΡΠΌΠ΅ΡΡΠ΅ΠΌ ΡΡΠ΅ΠΉΠΊΠΈ ΠΎΡ 1 Π΄ΠΎ _n_ ΡΠ»Π΅Π²Π° Π½Π°ΠΏΡΠ°Π²ΠΎ. ΠΡΠΎ ΠΊΠ°ΠΆΠ΄ΡΡ ΡΡΠ΅ΠΉΠΊΡ ΠΈΠ·Π²Π΅ΡΡΠ½ΠΎ, ΡΠ²ΠΎΠ±ΠΎΠ΄Π½Π° ΠΎΠ½Π° ΠΈΠ»ΠΈ ΠΏΡΠΈΠ½Π°Π΄Π»Π΅ΠΆΠΈΡ ΠΊΠ°ΠΊΠΎΠΌΡ-Π»ΠΈΠ±ΠΎ ΠΏΡΠΎΡΠ΅ΡΡΡ (Π² ΡΠ°ΠΊΠΎΠΌ ΡΠ»ΡΡΠ°Π΅ ΠΈΠ·Π²Π΅ΡΡΠ΅Π½ ΠΏΡΠΎΡΠ΅ΡΡ, ΠΊΠΎΡΠΎΡΠΎΠΌΡ ΠΎΠ½Π° ΠΏΡΠΈΠ½Π°Π΄Π»Π΅ΠΆΠΈΡ). ΠΠ»Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ ΠΏΡΠΎΡΠ΅ΡΡΠ° ΠΈΠ·... | 1,600 | false | true | true | false | false | true | false | false | false | false | 7,219 |
2041E | Problem - 2041E - 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 | true | false | false | false | false | true | false | false | false | false | 9 |
1498C | Gaurang has grown up in a mystical universe. He is faced by $$$n$$$ consecutive 2D planes. He shoots a particle of decay age $$$k$$$ at the planes. A particle can pass through a plane directly, however, every plane produces an identical copy of the particle going in the opposite direction with a decay age $$$k-1$$$. If... | 1,600 | false | false | false | true | true | false | true | false | false | false | 3,179 |
1420B | You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them. Hermit Lizard agreed to give Danik the lever. But to get a stone, Dani... | 1,200 | true | false | false | false | false | false | false | false | false | false | 3,579 |
1108A | You are given two segments $$$[l_1; r_1]$$$ and $$$[l_2; r_2]$$$ on the $$$x$$$-axis. It is guaranteed that $$$l_1 < r_1$$$ and $$$l_2 < r_2$$$. Segments may intersect, overlap or even coincide with each other. The example of two segments on the $$$x$$$-axis. Your problem is to find two integers $$$a$$$ and $$$b$$$ su... | 800 | false | false | true | false | false | false | false | false | false | false | 5,162 |
1704H1 | This is the easy version of this problem. The difference between easy and hard versions is the constraint on $$$k$$$ and the time limit. Also, in this version of the problem, you only need to calculate the answer when $$$n=k$$$. You can make hacks only if both versions of the problem are solved. Cirno is playing a war ... | 3,200 | true | false | false | true | false | true | false | false | false | false | 2,048 |
794B | Igor the analyst has adopted _n_ little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into _n_ pieces of equal area. Formally, the carrot can be viewed as an isosceles trian... | 1,200 | true | false | false | false | false | false | false | false | false | false | 6,599 |
931C | Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value _n_ times, and then compute the average value to lower the error. Kirill has already made his measurements, and has got the following integer values: _x_1, _x_2, ..., _x__n_. It is important that the values are clos... | 1,700 | true | false | true | false | false | false | false | false | false | false | 5,979 |
1762E | Let us call an edge-weighted tree with $$$n$$$ vertices numbered from $$$1$$$ to $$$n$$$ good if the weight of each edge is either $$$1$$$ or $$$-1$$$ and for each vertex $$$i$$$, the product of the edge weights of all edges having $$$i$$$ as one endpoint is $$$-1$$$. You are given a positive integer $$$n$$$. There are... | 2,600 | true | false | false | false | false | false | false | false | false | false | 1,736 |
1844F2 | The only difference between this problem and the easy version is the constraints on $$$t$$$ and $$$n$$$. You are given an array of $$$n$$$ positive integers $$$a_1,dots,a_n$$$, and a (possibly negative) integer $$$c$$$. Across all permutations $$$b_1,dots,b_n$$$ of the array $$$a_1,dots,a_n$$$, consider the minimum pos... | 2,800 | true | true | false | false | true | true | false | true | true | false | 1,217 |
363B | There is a fence in front of Polycarpus's home. The fence consists of _n_ planks of the same width which go one after another from left to right. The height of the _i_-th plank is _h__i_ meters, distinct planks can have distinct heights. Fence for _n_u2009=u20097 and _h_u2009=u2009[1,u20092,u20096,u20091,u20091,u20097... | 1,100 | false | false | false | true | false | false | true | false | false | false | 8,381 |
587B | Problem - 587B - Codeforces =============== xa0 ]( --- Finished β Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s... | 2,100 | false | false | false | true | false | false | false | false | false | false | 7,496 |
1682C | You are given an array $$$a$$$ of $$$n$$$ positive integers. Let $$$ ext{LIS}(a)$$$ denote the length of $$$ = $$$2$$$. $$$ ext{LIS}([underline{3}, underline{5}, underline{10}, underline{20}])$$$ = $$$4$$$. $$$ ext{LIS}([3, underline{1}, underline{2}, underline{4}])$$$ = $$$3$$$. We define array $$$a'$$$ as the array... | 1,400 | true | true | true | false | false | true | false | false | false | false | 2,177 |
1469C | You want to build a fence that will consist of $$$n$$$ equal sections. All sections have a width equal to $$$1$$$ and height equal to $$$k$$$. You will place all sections in one line side by side. Unfortunately, the ground beneath the fence is not flat. For simplicity, you can think that the ground level under the $$$i... | 1,600 | false | true | true | true | false | false | false | false | false | false | 3,336 |
1020B | In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $$$n$$$ students doing yet another trick. Let's assume that all these students are numbered from $$$1$$$ to $$$n$$$. The teacher came to student $$$a$$$ and put a hole in hi... | 1,000 | false | false | false | false | false | false | true | false | false | true | 5,591 |
731B | The programming competition season has already started and it's time to train for ICPC. Sereja coaches his teams for a number of year and he knows that to get ready for the training session it's not enough to prepare only problems and editorial. As the training sessions lasts for several hours, teams become hungry. Thu... | 1,100 | false | true | false | false | false | true | false | false | false | false | 6,875 |
600B | Problem - 600B - Codeforces =============== xa0 ]( "21794") β the sizes of arrays _a_ and _b_. The second line contains _n_ integers β the elements of array _a_ (u2009-u2009109u2009β€u2009_a__i_u2009β€u2009109). The third line contains _m_ integers β the elements of array _b_ (u2009-u2009109u2009β€u2009_b__j_... | 1,300 | false | false | false | false | true | false | false | true | true | false | 7,445 |
1649A | You are playing a very popular computer game. The next level consists of $$$n$$$ consecutive locations, numbered from $$$1$$$ to $$$n$$$, each of them containing either land or water. It is known that the first and last locations contain land, and for completing the level you have to move from the first location to the... | 800 | false | false | true | false | false | false | false | false | false | false | 2,377 |
1786A1 | This is an easy version of the problem. In this version, all cards have the same color. Alice has $$$n$$$ cards, each card is white, and the cards are stacked in a deck. Alice deals the cards to herself and to Bob, dealing at once several cards from the top of the deck in the following order: one card to herself, two c... | 800 | false | false | true | false | false | false | false | false | false | false | 1,566 |
385B | Problem - 385B - 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 | true | true | false | false | false | true | false | false | false | 8,290 |
1714G | You are given a rooted tree. It contains $$$n$$$ vertices, which are numbered from $$$1$$$ to $$$n$$$. The root is the vertex $$$1$$$. Each edge has two positive integer values. Thus, two positive integers $$$a_j$$$ and $$$b_j$$$ are given for each edge. Output $$$n-1$$$ numbers $$$r_2, r_3, dots, r_n$$$, where $$$r_i$... | 1,700 | false | false | false | false | true | false | false | true | false | false | 1,994 |
1403C | The mythic world of Chess Land is a rectangular grid of squares with $$$R$$$ rows and $$$C$$$ columns, $$$R$$$ being greater than or equal to $$$C$$$. Its rows and columns are numbered from $$$1$$$ to $$$R$$$ and $$$1$$$ to $$$C$$$, respectively. The inhabitants of Chess Land are usually mentioned as pieces in everyday... | 3,200 | true | false | true | true | false | false | false | false | false | false | 3,654 |
763C | Little Timofey likes integers a lot. Unfortunately, he is very young and can't work with very big integers, so he does all the operations modulo his favorite prime _m_. Also, Timofey likes to look for arithmetical progressions everywhere. One of his birthday presents was a sequence of distinct integers _a_1,u2009_a_2,u... | 2,600 | true | false | true | false | false | false | true | false | false | false | 6,735 |
188D | . Output Output the described pattern. Examples Output * ** *** **** ***** | 1,100 | false | false | true | false | false | false | false | false | false | false | 9,089 |
1350A | Orac is studying number theory, and he is interested in the properties of divisors. For two positive integers $$$a$$$ and $$$b$$$, $$$a$$$ is a divisor of $$$b$$$ if and only if there exists an integer $$$c$$$, such that $$$acdot c=b$$$. For $$$n ge 2$$$, we will denote as $$$f(n)$$$ the smallest positive divisor of $$... | 900 | true | false | false | false | false | false | false | false | false | false | 3,957 |
1692C | Mihai has an $$$8 imes 8$$$ chessboard whose rows are numbered from $$$1$$$ to $$$8$$$ from top to bottom and whose columns are numbered from $$$1$$$ to $$$8$$$ from left to right. Mihai has placed exactly one bishop on the chessboard. The bishop is not placed on the edges of the board. (In other words, the row and co... | 800 | false | false | true | false | false | false | false | false | false | false | 2,128 |
1278C | Karlsson has recently discovered a huge stock of berry jam jars in the basement of the house. More specifically, there were $$$2n$$$ jars of strawberry and blueberry jam. All the $$$2n$$$ jars are arranged in a row. The stairs to the basement are exactly in the middle of that row. So when Karlsson enters the basement, ... | 1,700 | false | true | true | true | true | false | false | false | false | false | 4,304 |
316D1 | Smart Beaver decided to be not only smart, but also a healthy beaver! And so he began to attend physical education classes at school X. In this school, physical education has a very creative teacher. One of his favorite warm-up exercises is throwing balls. Students line up. Each one gets a single ball in the beginning.... | 2,300 | false | false | false | true | false | false | true | false | false | false | 8,577 |
521E | You are organizing a cycling race on the streets of the city. The city contains _n_ junctions, some pairs of them are connected by roads; on each road you can move in any direction. No two roads connect the same pair of intersections, and no road connects the intersection with itself. You want the race to be open to bo... | 3,100 | false | false | false | false | false | false | false | false | false | true | 7,751 |
358D | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her _n_ hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to _n_ from left to right and started feeding them with... | 1,800 | false | true | false | true | false | false | false | false | false | false | 8,401 |
1560F2 | Problem - 1560F2 - 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 | false | true | false | true | false | true | true | false | false | false | 2,824 |
1846C | Rudolf has registered for a programming competition that will follow the rules of ICPC. The rules imply that for each solved problem, a participant gets $$$1$$$ point, and also incurs a penalty equal to the number of minutes passed from the beginning of the competition to the moment of solving the problem. In the final... | 1,200 | false | true | false | true | true | true | false | false | true | false | 1,206 |
917C | As we all know, Dart is some kind of creature from Upside Down world. For simplicity, we call their kind pollywogs. Dart and _x_u2009-u20091 other pollywogs are playing a game. There are _n_ stones in a row, numbered from 1 through _n_ from left to right. At most 1 pollywog may be sitting on each stone at a time. Initi... | 2,900 | false | false | false | true | false | false | false | false | false | false | 6,061 |
809C | After a wonderful evening in the restaurant the time to go home came. Leha as a true gentlemen suggested Noora to give her a lift. Certainly the girl agreed with pleasure. Suddenly one problem appeared: Leha cannot find his car on a huge parking near the restaurant. So he decided to turn to the watchman for help. Forma... | 2,600 | false | false | false | true | false | false | false | false | false | false | 6,526 |
1728C | Let's define $$$f(x)$$$ for a positive integer $$$x$$$ as the length of the base-10 representation of $$$x$$$ without leading zeros. I like to call it a digital logarithm. Similar to a digital root, if you are familiar with that. You are given two arrays $$$a$$$ and $$$b$$$, each containing $$$n$$$ positive integers. I... | 1,400 | false | true | false | false | true | false | false | false | true | false | 1,923 |
261A | Maxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems. There are _m_ types of discounts. We assume that the discounts are indexed from 1 to _m_. To use the discount number _i_, the customer takes a special basket, where he puts exactly _q__i_ items he buys. Under... | 1,400 | false | true | false | false | false | false | false | false | true | false | 8,790 |
1208H | You are given a tree of $$$n$$$ nodes. The tree is rooted at node $$$1$$$, which is not considered as a leaf regardless of its degree. Each leaf of the tree has one of the two colors: red or blue. Leaf node $$$v$$$ initially has color $$$s_{v}$$$. The color of each of the internal nodes (including the root) is determin... | 3,500 | false | false | true | false | true | false | false | false | false | false | 4,647 |
76F | Tourist walks along the _X_ axis. He can choose either of two directions and any speed not exceeding _V_. He can also stand without moving anywhere. He knows from newspapers that at time _t_1 in the point with coordinate _x_1 an interesting event will occur, at time _t_2 in the point with coordinate _x_2 β another one,... | 2,300 | false | false | false | true | true | false | false | true | false | false | 9,581 |
1250D | A large-scale conference on unnatural sciences is going to be held soon in Berland! In total, $$$n$$$ scientists from all around the world have applied. All of them have indicated a time segment when they will attend the conference: two integers $$$l_i$$$, $$$r_i$$$ β day of arrival and day of departure. Also, some of ... | 3,000 | false | false | false | true | false | false | false | false | false | false | 4,452 |
1137F | Lena is playing with matches. The natural question arising in the head of any child playing with matches is whether it's possible to set a tree on fire with a matches, or not. Let's say, that the tree is a connected graph without cycles and the vertices are labeled with integers $$$1, 2, ldots, n$$$. Also every vertex ... | 3,400 | false | false | false | false | true | false | false | false | false | false | 5,037 |
1828B | You are given an unsorted permutation $$$p_1, p_2, ldots, p_n$$$. To sort the permutation, you choose a constant $$$k$$$ ($$$k ge 1$$$) and do some operations on the permutation. In one operation, you can choose two integers $$$i$$$, $$$j$$$ ($$$1 le j < i le n$$$) such that $$$i - j = k$$$, then swap $$$p_i$$$ and $$$... | 900 | true | false | false | false | false | false | false | false | false | false | 1,315 |
936D | Vitya loves programming and problem solving, but sometimes, to distract himself a little, he plays computer games. Once he found a new interesting game about tanks, and he liked it so much that he went through almost all levels in one day. Remained only the last level, which was too tricky. Then Vitya remembered that h... | 3,000 | false | true | false | true | false | false | false | false | false | false | 5,955 |
35B | Once upon a time, when the world was more beautiful, the sun shone brighter, the grass was greener and the sausages tasted better Arlandia was the most powerful country. And its capital was the place where our hero DravDe worked. He couldnβt program or make up problems (in fact, few people saw a computer those days) bu... | 1,700 | false | false | true | false | false | false | false | false | false | false | 9,822 |
1720D2 | It is the hard version of the problem. The only difference is that in this version $$$a_i le 10^9$$$. You are given an array of $$$n$$$ integers $$$a_0, a_1, a_2, ldots a_{n - 1}$$$. Bryap wants to find the longest beautiful subsequence in the array. An array $$$b = xa0β the number of test cases. The description of th... | 2,400 | false | false | false | true | true | false | false | false | false | false | 1,961 |
1637E | You are given an array $$$a$$$ of length $$$n$$$. Let $$$cnt_x$$$ be the number of elements from the array which are equal to $$$x$$$. Let's also define $$$f(x, y)$$$ as $$$(cnt_x + cnt_y) cdot (x + y)$$$. Also you are given $$$m$$$ bad pairs $$$(x_i, y_i)$$$. Note that if $$$(x, y)$$$ is a bad pair, then $$$(y, x)$$$ ... | 2,100 | false | false | true | false | false | false | true | true | false | false | 2,430 |
618D | A group of _n_ cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are roads in total. It takes exactly _y_ seconds to traverse any single road. A spanning tree is a set of roads containing exactly _n_u2009-u20091 roads such that it's possible to travel between ... | 2,200 | false | true | false | true | false | false | false | false | false | false | 7,361 |
145B | Problem - 145B - Codeforces =============== xa0 ]( --- Finished β Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s... | 1,800 | false | false | false | false | false | true | false | false | false | false | 9,294 |
1260E | You are organizing a boxing tournament, where $$$n$$$ boxers will participate ($$$n$$$ is a power of $$$2$$$), and your friend is one of them. All boxers have different strength from $$$1$$$ to $$$n$$$, and boxer $$$i$$$ wins in the match against boxer $$$j$$$ if and only if $$$i$$$ is stronger than $$$j$$$. The tourna... | 2,400 | false | true | false | true | false | false | true | false | false | false | 4,390 |
666D | Group of Berland scientists, with whom you have a close business relationship, makes a research in the area of peaceful nuclear energy. In particular, they found that a group of four nanobots, placed on a surface of a plate, can run a powerful chain reaction under certain conditions. To be precise, researchers introduc... | 3,000 | false | false | false | false | false | false | true | false | false | false | 7,152 |
1010D | Natasha travels around Mars in the Mars rover. But suddenly it broke down, namelyxa0β the logical scheme inside it. The scheme is an undirected tree (connected acyclic graph) with a root in the vertex $$$1$$$, in which every leaf (excluding root) is an input, and all other vertices are logical elements, including the r... | 2,000 | false | false | true | false | false | false | false | false | false | true | 5,632 |
1407B | Alexander is a well-known programmer. Today he decided to finally go out and play football, but with the first hit he left a dent on the new Rolls-Royce of the wealthy businessman Big Vova. Vladimir has recently opened a store on the popular online marketplace "Zmey-Gorynych", and offers Alex a job: if he shows his pro... | 1,300 | true | true | false | false | false | false | true | false | false | false | 3,640 |
1981A | Turtle and Piggy are playing a number game. First, Turtle will choose an integer $$$x$$$, such that $$$l le x le r$$$, where $$$l, r$$$ are given. It's also guaranteed that $$$2l le r$$$. Then, Piggy will keep doing the following operation until $$$x$$$ becomes $$$1$$$: Choose an integer $$$p$$$ such that $$$p ge 2$$$... | 800 | true | true | false | false | false | false | true | false | false | false | 402 |
1763E | Let's call an ordered pair of nodes $$$(u, v)$$$ in a directed graph unidirectional if $$$u eq v$$$, there exists a path from $$$u$$$ to $$$v$$$, and there are no paths from $$$v$$$ to $$$u$$$. A directed graph is called $$$p$$$-reachable if it contains exactly $$$p$$$ ordered pairs of nodes $$$(u, v)$$$ such that $$$... | 2,200 | true | false | false | true | false | false | false | false | false | true | 1,729 |
1372A | # Omkar and Completion Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes You have been blessed as a child of Omkar. To express your gratitude, please solve this problem for Omkar! An array a of length n is called complete if all elements are positive and donβt e... | 800 | false | false | true | false | false | true | false | false | false | false | 3,807 |
799F | Butler Ostin wants to show Arkady that rows of odd number of fountains are beautiful, while rows of even number of fountains are not. The butler wants to show Arkady _n_ gardens. Each garden is a row of _m_ cells, the _i_-th garden has one fountain in each of the cells between _l__i_ and _r__i_ inclusive, and there are... | 3,500 | false | false | false | false | true | false | false | false | false | false | 6,571 |
1552D | You are given a sequence of $$$n$$$ integers $$$a_1, , a_2, , dots, , a_n$$$. Does there exist a sequence of $$$n$$$ integers $$$b_1, , b_2, , dots, , b_n$$$ such that the following property holds? For each $$$1 le i le n$$$, there exist two (not necessarily distinct) indices $$$j$$$ and $$$k$$$ ($$$1 le j, , k le n$$... | 1,800 | true | false | false | true | false | true | true | false | false | true | 2,881 |
846E | Igor is a post-graduate student of chemistry faculty in Berland State University (BerSU). He needs to conduct a complicated experiment to write his thesis, but laboratory of BerSU doesn't contain all the materials required for this experiment. Fortunately, chemical laws allow material transformations (yes, chemistry in... | 2,300 | false | true | false | false | false | false | false | false | false | false | 6,373 |
43B | Problem - 43B - 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 | false | false | true | false | false | false | false | false | false | false | 9,773 |
145A | Problem - 145A - 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 | false | false | 9,295 |
1458C | You are given a square matrix of size $$$n$$$. Every row and every column of this matrix is a permutation of $$$1$$$, $$$2$$$, $$$ldots$$$, $$$n$$$. Let $$$a_{i, j}$$$ be the element at the intersection of $$$i$$$-th row and $$$j$$$-th column for every $$$1 leq i, j leq n$$$. Rows are numbered $$$1, ldots, n$$$ top to ... | 2,700 | true | false | false | false | false | false | false | false | false | false | 3,392 |
8E | One Martian boy called Zorg wants to present a string of beads to his friend from the Earth β Masha. He knows that Masha likes two colours: blue and red, β and right in the shop where he has come, there is a variety of adornments with beads of these two colours. All the strings of beads have a small fastener, and if on... | 2,600 | false | false | false | true | false | false | false | false | false | true | 9,951 |
1210C | Kamil likes streaming the competitive programming videos. His MeTube channel has recently reached $$$100$$$ million subscribers. In order to celebrate this, he posted a video with an interesting problem he couldn't solve yet. Can you help him? You're given a tree β a connected undirected graph consisting of $$$n$$$ ver... | 2,000 | true | false | false | false | false | false | false | false | false | false | 4,634 |
1884C | The array $$$a_1, a_2, ldots, a_m$$$ is initially filled with zeroes. You are given $$$n$$$ pairwise distinct segments $$$1 le l_i le r_i le m$$$. You have to select an arbitrary subset of these segments (in particular, you may select an empty set). Next, you do the following: For each $$$i = 1, 2, ldots, n$$$, if the... | 1,700 | false | true | false | true | true | false | true | false | true | false | 981 |
962E | The cities of Byteland and Berland are located on the axis $$$Ox$$$. In addition, on this axis there are also disputed cities, which belong to each of the countries in their opinion. Thus, on the line $$$Ox$$$ there are three types of cities: the cities of Byteland, the cities of Berland, disputed cities. Recently, ... | 2,200 | false | true | false | false | false | true | false | false | false | false | 5,852 |
403E | You have two rooted undirected trees, each contains _n_ vertices. Let's number the vertices of each tree with integers from 1 to _n_. The root of each tree is at vertex 1. The edges of the first tree are painted blue, the edges of the second one are painted red. For simplicity, let's say that the first tree is blue and... | 2,900 | false | false | true | false | true | false | false | false | false | false | 8,211 |
1718D | We call an array $$$a$$$ pure if all elements in it are pairwise distinct. For example, an array $$$[1, 7, 9]$$$ is pure, $$$[1, 3, 3, 7]$$$ isn't, because $$$3$$$ occurs twice in it. A pure array $$$b$$$ is similar to a pure array $$$c$$$ if their lengths $$$n$$$ are the same and for all pairs of indices $$$l$$$, $$$r... | 3,300 | true | true | false | false | true | false | false | false | false | false | 1,971 |
1722G | Problem - 1722G - 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,500 | false | true | false | false | false | true | false | false | false | false | 1,947 |
1601B | Frog Gorf is traveling through Swamp kingdom. Unfortunately, after a poor jump, he fell into a well of $$$n$$$ meters depth. Now Gorf is on the bottom of the well and has a long way up. The surface of the well's walls vary in quality: somewhere they are slippery, but somewhere have convenient ledges. In other words, if... | 1,900 | false | false | false | true | true | false | false | false | false | true | 2,650 |
231C | A piece of paper contains an array of _n_ integers _a_1,u2009_a_2,u2009...,u2009_a__n_. Your task is to find a number that occurs the maximum number of times in this array. However, before looking for such number, you are allowed to perform not more than _k_ following operations β choose an arbitrary element from the a... | 1,600 | false | false | false | false | false | false | false | true | true | false | 8,914 |
705A | Problem - 705A - 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 | 7,001 |
736D | Problem - 736D - Codeforces =============== xa0 ]( --- Finished β Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s... | 2,800 | true | false | false | false | false | false | false | false | false | false | 6,847 |
1044E | You are given an $$$n imes m$$$ grid. Each grid cell is filled with a unique integer from $$$1$$$ to $$$nm$$$ so that each integer appears exactly once. In one operation, you can choose an arbitrary cycle of the grid and move all integers along that cycle one space over. Here, a cycle is any sequence that satisfies th... | 3,100 | false | false | true | false | false | false | false | false | false | false | 5,472 |
1280E | Your friend Kirchhoff is shocked with the current state of electronics design. "Ohmygosh! Watt is wrong with the field? All these circuits are inefficient! There's so much capacity for improvement. The electrical engineers must not conduct their classes very well. It's absolutely revolting" he said. The negativity just... | 2,900 | true | false | false | false | false | false | false | false | false | false | 4,290 |
1553G | Consider a sequence of distinct integers $$$a_1, ldots, a_n$$$, each representing one node of a graph. There is an edge between two nodes if the two values are not coprime, i.xa0e. they have a common divisor greater than $$$1$$$. There are $$$q$$$ queries, in each query, you want to get from one given node $$$a_s$$$ to... | 2,700 | true | false | false | false | false | true | true | false | false | true | 2,869 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.