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
1473G
Consider a road consisting of several rows. Each row is divided into several rectangular tiles, and all tiles in the same row are equal. The first row contains exactly one rectangular tile. Look at the picture below which shows how the tiles are arranged. The road is constructed as follows: the first row consists of $...
2,800
true
false
false
true
false
false
false
false
false
false
3,311
1909C
You have $$$n$$$ intervals $$$[l_1, r_1], [l_2, r_2], dots, [l_n, r_n]$$$, such that $$$l_i < r_i$$$ for each $$$i$$$, and all the endpoints of the intervals are distinct. The $$$i$$$-th interval has weight $$$c_i$$$ per unit length. Therefore, the weight of the $$$i$$$-th interval is $$$c_i cdot (r_i - l_i)$$$. You do...
1,400
true
true
false
false
true
true
false
false
true
false
855
281A
Problem - 281A - 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
8,710
1203E
There are $$$n$$$ boxers, the weight of the $$$i$$$-th boxer is $$$a_i$$$. Each of them can change the weight by no more than $$$1$$$ before the competition (the weight cannot become equal to zero, that is, it must remain positive). Weight is always an integer number. It is necessary to choose the largest boxing team i...
1,500
false
true
false
false
false
false
false
false
true
false
4,678
1431H
Marina plays a new rogue-like game. In this game, there are $$$n$$$ different character species and $$$m$$$ different classes. The game is played in runs; for each run, Marina has to select a species and a class for her character. If she selects the $$$i$$$-th species and the $$$j$$$-th class, she will get $$$c_{i, j}$...
2,600
false
true
false
false
false
false
true
false
false
false
3,502
434E
One day, Okazaki Tomoya has bought a tree for Furukawa Nagisa's birthday. The tree is so strange that every node of the tree has a value. The value of the _i_-th node is _v__i_. Now Furukawa Nagisa and Okazaki Tomoya want to play a game on the tree. Let (_s_,u2009_e_) be the path from node _s_ to node _e_, we can write...
3,000
false
false
false
false
false
false
false
true
true
false
8,103
748B
Santa Claus decided to disassemble his keyboard to clean it. After he returned all the keys back, he suddenly realized that some pairs of keys took each other's place! That is, Santa suspects that each key is either on its place, or on the place of another key, which is located exactly where the first key should be. In...
1,500
false
false
true
false
false
false
false
false
false
false
6,803
588A
Duff is addicted to meat! Malek wants to keep her happy for _n_ days. In order to be happy in _i_-th day, she needs to eat exactly _a__i_ kilograms of meat. There is a big shop uptown and Malek wants to buy meat for her from there. In _i_-th day, they sell meat for _p__i_ dollars per kilogram. Malek knows all numbers _...
900
false
true
false
false
false
false
false
false
false
false
7,491
22B
Problem - 22B - 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,500
false
false
false
true
false
false
true
false
false
false
9,887
45B
There are _n_ students studying in the 6th grade, in group "B" of a berland secondary school. Every one of them has exactly one friend whom he calls when he has some news. Let us denote the friend of the person number _i_ by _g_(_i_). Note that the friendships are not mutual, i.e. _g_(_g_(_i_)) is not necessarily equal...
2,200
false
false
false
true
false
false
false
false
false
false
9,758
1271D
You play a strategic video game (yeah, we ran out of good problem legends). In this game you control a large army, and your goal is to conquer $$$n$$$ castles of your opponent. Let's describe the game process in detail. Initially you control an army of $$$k$$$ warriors. Your enemy controls $$$n$$$ castles; to conquer t...
2,100
false
true
true
true
true
false
false
false
true
false
4,332
1408F
You are given an integer $$$n$$$. You should find a list of pairs $$$(x_1, y_1)$$$, $$$(x_2, y_2)$$$, ..., $$$(x_q, y_q)$$$ ($$$1 leq x_i, y_i leq n$$$) satisfying the following condition. Let's consider some function $$$f: mathbb{N} imes mathbb{N} o mathbb{N}$$$ (we define $$$mathbb{N}$$$ as the set of positive inte...
2,300
false
false
false
false
false
true
false
false
false
false
3,631
299B
Problem - 299B - 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...
900
false
false
true
false
false
false
true
false
false
false
8,636
278B
Coming up with a new problem isn't as easy as many people think. Sometimes it is hard enough to name it. We'll consider a title original if it doesn't occur as a substring in any titles of recent Codeforces problems. You've got the titles of _n_ last problems β€” the strings, consisting of lowercase English letters. Your...
1,500
false
false
false
false
false
false
true
false
false
false
8,721
1987F2
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. You are given an array of integers $$$a$$$ of length $$$n$$$. In one operation, you will perform the following two-step process: 1. Choo...
2,600
false
false
false
true
false
false
false
false
false
false
351
475A
The final round of Bayan Programming Contest will be held in Tehran, and the participants will be carried around with a yellow bus. The bus has 34 passenger seats: 4 seats in the last row and 3 seats in remaining rows. The event coordinator has a list of _k_ participants who should be picked up at the airport. When a p...
1,100
false
false
true
false
false
false
false
false
false
false
7,934
1131E
Roman and Denis are on the trip to the programming competition. Since the trip was long, they soon got bored, and hence decided to came up with something. Roman invented a pizza's recipe, while Denis invented a string multiplication. According to Denis, the result of multiplication (product) of strings $$$s$$$ of lengt...
2,300
false
true
false
true
false
false
false
false
false
false
5,064
852E
John has just bought a new car and is planning a journey around the country. Country has _N_ cities, some of which are connected by bidirectional roads. There are _N_u2009-u20091 roads and every city is reachable from any other city. Cities are labeled from 1 to _N_. John first has to select from which city he will sta...
2,100
false
false
false
true
false
false
false
false
false
false
6,339
1005E2
You are given an integer sequence $$$a_1, a_2, dots, a_n$$$. Find the number of pairs of indices $$$(l, r)$$$ ($$$1 le l le r le n$$$) such that the value of median of $$$a_l, a_{l+1}, dots, a_r$$$ is exactly the given number $$$m$$$. The median of a sequence is the value of an element which is in the middle of the seq...
2,400
false
false
false
false
false
false
false
false
true
false
5,657
1969F
Problem - 1969F - 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
true
true
true
false
false
false
false
false
false
487
2009C
Freya the Frog is traveling on the 2D coordinate plane. She is currently at point $$$(0,0)$$$ and wants to go to point $$$(x,y)$$$. In one move, she chooses an integer $$$d$$$ such that $$$0 leq d leq k$$$ and jumps $$$d$$$ spots forward in the direction she is facing. Initially, she is facing the positive $$$x$$$ dire...
1,100
true
false
true
false
false
false
false
false
false
false
198
608A
Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an elevator in one of its other hotels. The elevator is special β€” it starts on the top floor, can only move down, and has infinite capacity. Floors are numbered from 0 to _s_ and elevator initially starts on floor...
1,000
true
false
true
false
false
false
false
false
false
false
7,414
158B
Problem - 158B - Codeforces =============== xa0 , and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum number of cars will the children need if all members of each group should ride in the same taxi (but one taxi can take m...
1,100
false
true
true
false
false
false
false
false
false
false
9,244
1975G
One day, Zimpha casually came up with a problem. As a member of "Zimpha fan club", you decided to solve that problem. You are given two strings $$$s$$$ and $$$t$$$ of length $$$n$$$ and $$$m$$$, respectively. Both strings only consist of lowercase English letters, - and *. You need to replace all occurrences of and -, ...
3,000
true
true
false
false
false
false
false
false
false
false
436
1624C
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers. You can perform operations on it. In one operation you can replace any element of the array $$$a_i$$$ with $$$lfloor frac{a_i}{2} floor$$$, that is, by an integer part of dividing $$$a_i$$$ by $$$2$$$ (rounding down). See if you can apply the oper...
1,100
true
true
false
false
false
true
false
false
false
false
2,498
1949D
You are designing a new video game. It has $$$n$$$ scenarios, which the player may play in any order, but each scenario must be played exactly once. When a player switches from a scenario to another scenario, the game shows a specially crafted transition video to make it all feel part of one big story. This video is sp...
2,600
false
false
false
false
false
true
false
false
false
false
589
1798C
The store sells $$$n$$$ types of candies with numbers from $$$1$$$ to $$$n$$$. One candy of type $$$i$$$ costs $$$b_i$$$ coins. In total, there are $$$a_i$$$ candies of type $$$i$$$ in the store. You need to pack all available candies in packs, each pack should contain only one type of candies. Formally, for each type ...
1,700
true
true
false
false
false
false
false
false
false
false
1,488
1800A
You were walking down the street and heard a sound. The sound was described by the string $$$s$$$ consisting of lowercase and uppercase Latin characters. Now you want to find out if the sound was a cat meowing. For the sound to be a meowing, the string can only contain the letters 'm', 'e', 'o' and 'w', in either upper...
800
false
false
true
false
false
false
false
false
false
false
1,475
234C
Scientists say a lot about the problems of global warming and cooling of the Earth. Indeed, such natural phenomena strongly influence all life on our planet. Our hero Vasya is quite concerned about the problems. He decided to try a little experiment and observe how outside daily temperature changes. He hung out a therm...
1,300
false
false
true
true
false
false
false
false
false
false
8,902
1251E1
The only difference between easy and hard versions is constraints. Now elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you. There are $$$n$$$ voters, and two ways to convince each of them to vote for you. The first way to convince the $$$i$$$-th voter is to pay him ...
2,300
false
true
false
true
true
false
false
false
false
false
4,437
1737F
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Dytechlab Cup 2022 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 see...
3,300
true
false
false
false
false
true
false
false
false
false
1,863
691F
Couple Cover, a wildly popular luck-based game, is about to begin! Two players must work together to construct a rectangle. A bag with _n_ balls, each with an integer written on it, is placed on the table. The first player reaches in and grabs a ball randomly (all balls have equal probability of being chosen) β€” the num...
2,200
false
false
false
true
false
false
true
false
false
false
7,042
1993A
Tim is doing a test consisting of $$$4n$$$ questions; each question has $$$4$$$ options: 'A', 'B', 'C', and 'D'. For each option, there are exactly $$$n$$$ correct answers corresponding to that option β€” meaning there are $$$n$$$ questions with the answer 'A', $$$n$$$ questions with the answer 'B', $$$n$$$ questions wit...
800
false
true
true
false
false
false
false
false
false
false
312
1971F
Problem - 1971F - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,600
true
false
true
false
false
false
true
true
false
false
460
1910D
You are given an array $$$a_1, a_2, dots, a_n$$$, consisting of $$$n$$$ integers. You goal is to make is strictly increasing. To achieve that, you perform each of the following operations exactly once: first, remove any element; second, select any number of elements (possibly, none or all $$$n-1$$$) and add $$$1$$$ t...
1,800
false
true
false
false
false
false
false
false
false
false
844
1847F
While tracking Diavolo's origins, Giorno receives a secret code from Polnareff. The code can be represented as an infinite sequence of positive integers: $$$a_1, a_2, dots $$$. Giorno immediately sees the pattern behind the code. The first $$$n$$$ numbers $$$a_1, a_2, dots, a_n$$$ are given. For $$$i > n$$$ the value o...
2,500
true
true
false
false
true
false
false
true
true
false
1,195
1007C
This is an interactive problem. Vasya and Vitya play a game. Vasya thought of two integers $$$a$$$ and $$$b$$$ from $$$1$$$ to $$$n$$$ and Vitya tries to guess them. Each round he tells Vasya two numbers $$$x$$$ and $$$y$$$ from $$$1$$$ to $$$n$$$. If both $$$x=a$$$ and $$$y=b$$$ then Vitya wins. Else Vasya must say on...
3,000
false
false
false
false
false
false
false
true
false
false
5,647
1065B
Vasya has got an undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. This graph doesn't contain any self-loops or multiple edges. Self-loop is an edge connecting a vertex to itself. Multiple edges are a pair of edges such that they connect the same pair of vertices. Since the graph is undirected, the pai...
1,300
false
false
false
false
false
true
false
false
false
true
5,387
915F
Problem - 915F - 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,400
false
false
false
false
true
false
false
false
false
true
6,070
1709A
There are three doors in front of you, numbered from $$$1$$$ to $$$3$$$ from left to right. Each door has a lock on it, which can only be opened with a key with the same number on it as the number on the door. There are three keysxa0β€” one for each door. Two of them are hidden behind the doors, so that there is no more ...
800
true
true
true
false
false
false
true
false
false
false
2,026
1929C
Sasha decided to give his girlfriend the best handbag, but unfortunately for Sasha, it is very expensive. Therefore, Sasha wants to earn it. After looking at earning tips on the internet, he decided to go to the casino. Sasha knows that the casino operates under the following rules. If Sasha places a bet of $$$y$$$ coi...
1,400
true
true
false
false
false
true
true
true
false
false
715
722D
You are given a set _Y_ of _n_ distinct positive integers _y_1,u2009_y_2,u2009...,u2009_y__n_. Set _X_ of _n_ distinct positive integers _x_1,u2009_x_2,u2009...,u2009_x__n_ is said to generate set _Y_ if one can transform _X_ to _Y_ by applying some number of the following two operation to integers in _X_: 1. Take any ...
1,900
false
true
false
false
true
false
false
true
false
false
6,923
1651E
Let's denote the size of the maximum matching in a graph $$$G$$$ as $$$mathit{MM}(G)$$$. You are given a bipartite graph. The vertices of the first part are numbered from $$$1$$$ to $$$n$$$, the vertices of the second part are numbered from $$$n+1$$$ to $$$2n$$$. Each vertex's degree is $$$2$$$. For a tuple of four int...
2,600
true
true
false
false
false
true
true
false
false
false
2,364
913G
Problem - 913G - Codeforces =============== xa0 ) digits. Here _length_(_m_) is the length of the decimal notation of _m_. Note that you don't have to minimize _k__i_. The decimal notations in this problem do not contain leading zeros. Input The first line contains a single integer _n_ (1u2009≀u2009_n_u20...
3,200
true
false
false
false
false
false
false
false
false
false
6,085
1526C1
This is the easy version of the problem. The only difference is that in this version $$$n leq 2000$$$. You can make hacks only if both versions of the problem are solved. There are $$$n$$$ potions in a line, with potion $$$1$$$ on the far left and potion $$$n$$$ on the far right. Each potion will increase your health b...
1,500
false
true
false
true
true
false
true
false
false
false
3,034
1588F
You are given an array of integers $$$a$$$ of size $$$n$$$ and a permutation $$$p$$$ of size $$$n$$$. There are $$$q$$$ queries of three types coming to you: 1. For given numbers $$$l$$$ and $$$r$$$, calculate the sum in array $$$a$$$ on the segment from $$$l$$$ to $$$r$$$: $$$sumlimits_{i=l}^{r} a_i$$$. 2. You are giv...
3,500
false
false
false
false
true
false
false
true
false
true
2,694
1416D
You are given an undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. Initially there is a single integer written on every vertex: the vertex $$$i$$$ has $$$p_i$$$ written on it. All $$$p_i$$$ are distinct integers from $$$1$$$ to $$$n$$$. You have to process $$$q$$$ queries of two types: $$$1$$$ $$$v$$$...
2,600
false
false
true
false
true
false
false
false
false
true
3,599
382D
Ksenia has a chessboard of size _n_u2009Γ—u2009_m_. Each cell of the chessboard contains one of the characters: "<", ">", "^", "v", "#". The cells that contain character "#" are blocked. We know that all chessboard cells that touch the border are blocked. Ksenia is playing with two pawns on this chessboard. Initially, s...
2,200
false
false
true
false
false
false
false
false
false
true
8,300
1585F
Problem - 1585F - Codeforces =============== xa0 ") Editorial") , and $$$b_i eq b_{i+1}$$$ for every $$$i$$$ ($$$1 le i le n - 1$$$). The number of such arrays can be very large, so print it modulo $$$998,244,353$$$. Input The first line contains a single integer $$$n$$$ ($$$1 le n le 2 cdot 10^5$$$)xa0β€”...
2,400
true
false
false
true
false
false
false
false
false
false
2,697
1279E
Yeah, we failed to make up a New Year legend for this problem. A permutation of length $$$n$$$ is an array of $$$n$$$ integers such that every integer from $$$1$$$ to $$$n$$$ appears in it exactly once. An element $$$y$$$ of permutation $$$p$$$ is reachable from element $$$x$$$ if $$$x = y$$$, or $$$p_x = y$$$, or $$$p...
2,700
false
false
false
true
false
false
false
false
false
false
4,296
996A
Problem - 996A - Codeforces =============== xa0 ]( "Codeforces Round #492 . The denominations for dollar bills are $$$1$$$, $$$5$$$, $$$10$$$, $$$20$$$, $$$100$$$. What is the minimum number of bills Allen could receive after withdrawing his entire balance? Input The first and only line of input contains a si...
800
false
true
false
true
false
false
false
false
false
false
5,720
1609A
William has array of $$$n$$$ numbers $$$a_1, a_2, dots, a_n$$$. He can perform the following sequence of operations any number of times: 1. Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ 2. $$$a_i = frac{a_i}{2}$$$ 3. $$$a_j = a_j cdot 2$$$ Help William find the max...
900
true
true
true
false
false
false
false
false
false
false
2,608
1579E2
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 744 (Div. 3) Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If...
1,700
false
true
false
false
true
false
false
false
false
false
2,736
347B
Problem - 347B - 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
true
false
true
false
false
false
true
false
false
false
8,443
835A
Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consisting of _s_ characters. The first participant types one character in _v_1 milliseconds and has ping _t_1 milliseconds. The second participant types one character in _v_2 milliseconds and has ping _...
800
true
false
false
false
false
false
false
false
false
false
6,427
275B
Problem - 275B - 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,700
false
false
true
false
false
true
false
false
false
false
8,733
1543D1
This is the easy version of the problem. The only difference is that here $$$k=2$$$. You can make hacks only if both the versions of the problem are solved. This is an interactive problem. Every decimal number has a base $$$k$$$ equivalent. The individual digits of a base $$$k$$$ number are called $$$k$$$-its. Let's de...
1,700
true
false
false
false
false
true
false
false
false
false
2,925
633B
Problem - 633B - Codeforces =============== xa0 ]( "Announcement") xa0β€” the required number of trailing zeroes in factorial. Output First print _k_xa0β€” the number of values of _n_ such that the factorial of _n_ ends with _m_ zeroes. Then print these _k_ integers in increasing order. Examples Input 1 Outpu...
1,300
true
false
false
false
false
true
true
false
false
false
7,274
1391A
A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$. Description of the test cases follows. The first and only line of every test case contains a single integer $$$n$$$ ($$$1 le n le 100$$$). Output For every test, output any g...
800
true
false
false
false
false
true
false
false
false
false
3,721
1948F
There are $$$n$$$ bags numbered from $$$1$$$ to $$$n$$$, the $$$i$$$-th bag contains $$$a_i$$$ golden coins and $$$b_i$$$ silver coins. The value of a gold coin is $$$1$$$. The value of a silver coin is either $$$0$$$ or $$$1$$$, determined for each silver coin independently ($$$0$$$ with probability $$$frac{1}{2}$$$, ...
2,500
true
false
false
false
false
false
false
false
false
false
594
1990A
Alice and Bob are playing a game in an array $$$a$$$ of size $$$n$$$. They take turns to do operations, with Alice starting first. The player who can not operate will lose. At first, a variable $$$mx$$$ is set to $$$0$$$. In one operation, a player can do: Choose an index $$$i$$$ ($$$1 le i le n$$$) such that $$$a_{i}...
900
false
true
false
false
false
false
true
false
true
false
335
1487G
You have $$$c_1$$$ letters 'a', $$$c_2$$$ letters 'b', ..., $$$c_{26}$$$ letters 'z'. You want to build a beautiful string of length $$$n$$$ from them (obviously, you cannot use the $$$i$$$-th letter more than $$$c_i$$$ times). Each $$$c_i$$$ is greater than $$$frac{n}{3}$$$. A string is called beautiful if there are n...
2,700
true
false
false
true
false
false
false
false
false
false
3,240
1801F
Mom bought the boy Vasya a $$$n$$$-dimensional chocolate bar, which is a $$$n$$$-dimensional cube with the length of each side equal to $$$1$$$. The chocolate is planned to be divided into slices. According to the $$$i$$$th dimension, it can be divided by hyperplanes into $$$a_i$$$ equal parts. Thus, the chocolate is d...
2,700
true
false
false
true
false
false
false
false
false
false
1,461
1234B2
The only difference between easy and hard versions are constraints on $$$n$$$ and $$$k$$$. You are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most $$$k$$$ most recent conversations with your friends. Initially, the screen is empty (i.e. the number of displayed conve...
1,300
false
false
true
false
true
false
false
false
false
false
4,523
1884E
Consider an array of integers $$$b_0, b_1, ldots, b_{n-1}$$$. Your goal is to make all its elements equal. To do so, you can perform the following operation several (possibly, zero) times: Pick a pair of indices $$$0 le l le r le n-1$$$, then for each $$$l le i le r$$$ increase $$$b_i$$$ by $$$1$$$ (i.xa0e. replace $$...
2,800
true
true
true
false
false
false
false
false
false
false
979
1090K
, # Problem A. Right Expansion Of The Mind Time limit: 2 seconds Memory limit: 512 megabytes One day n people decided to expand their mind. Initially, the mind of the i-th person is two strings si and ti consisting of lowercase English letters. After the expansion, the mind of the person becomes an infinite to the rig...
2,000
true
false
false
false
false
false
false
false
false
false
5,262
1792C
You are given a permutation $$$p$$$ of length $$$n$$$ (a permutation of length $$$n$$$ is an array of length $$$n$$$ in which each integer from $$$1$$$ to $$$n$$$ occurs exactly once). You can perform the following operation any number of times (possibly zero): 1. choose two different elements $$$x$$$ and $$$y$$$ and e...
1,500
true
true
false
false
false
false
true
true
false
false
1,525
287B
Vova, the Ultimate Thule new shaman, wants to build a pipeline. As there are exactly _n_ houses in Ultimate Thule, Vova wants the city to have exactly _n_ pipes, each such pipe should be connected to the water supply. A pipe can be connected to the water supply if there's water flowing out of it. Initially Vova has onl...
1,700
true
false
false
false
false
false
false
true
false
false
8,685
938A
Problem - 938A - 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
5,951
1276C
Problem - 1276C - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
2,300
true
true
false
false
true
true
true
false
false
false
4,313
135B
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
1,600
true
false
false
false
false
false
true
false
false
false
9,336
604B
Kevin Sun wants to move his precious collection of _n_ cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into _k_ boxes of a fixed size. In order to keep his collection safe during transportation, he won't place more than two cowbells into a sin...
1,400
false
true
false
false
false
false
false
true
false
false
7,427
1466E
Only a few know that Pan and Apollo weren't only battling for the title of the GOAT musician. A few millenniums later, they also challenged each other in math (or rather in fast calculations). The task they got to solve is the following: Let $$$x_1, x_2, ldots, x_n$$$ be the sequence of $$$n$$$ non-negative integers. F...
1,800
true
false
false
false
false
false
true
false
false
false
3,362
538H
_T_ students applied into the ZPP class of Summer Irrelevant School. The organizing committee of the school may enroll any number of them, but at least _t_ students must be enrolled. The enrolled students should be divided into two groups in any manner (it is possible that one of the groups will be empty!) During a shi...
3,200
false
true
false
false
true
false
false
false
false
false
7,681
1881F
You have a tree with $$$n$$$ vertices, some of which are marked. A tree is a connected undirected graph without cycles. Let $$$f_i$$$ denote the maximum distance from vertex $$$i$$$ to any of the marked vertices. Your task is to find the minimum value of $$$f_i$$$ among all vertices. For example, in the tree shown in t...
1,700
false
false
false
true
false
false
false
false
false
true
999
1055D
Alice has written a program and now tries to improve its readability. One of the ways to improve readability is to give sensible names to the variables, so now Alice wants to rename some variables in her program. In her IDE there is a command called "massive refactoring", which can replace names of many variable in jus...
2,400
false
true
true
false
false
false
false
false
false
false
5,436
1607C
Yelisey has an array $$$a$$$ of $$$n$$$ integers. If $$$a$$$ has length strictly greater than $$$1$$$, then Yelisei can apply an operation called minimum extraction to it: 1. First, Yelisei finds the minimal number $$$m$$$ in the array. If there are several identical minima, Yelisey can choose any of them. 2. Then the ...
1,000
false
false
false
false
false
false
true
false
true
false
2,621
2039F1
This is the easy version of the problem. The only differences between the two versions of this problem are the constraints on $$$t$$$, $$$m$$$, and the sum of $$$m$$$. You can only make hacks if both versions of the problem are solved. For an integer array $$$a$$$ of length $$$n$$$, define $$$f(k)$$$ as the = operatorn...
2,800
true
false
false
true
false
false
true
false
false
false
18
2020F
Let $$$n$$$ and $$$d$$$ be positive integers. We build the the divisor tree $$$T_{n,d}$$$ as follows: The root of the tree is a node marked with number $$$n$$$. This is the $$$0$$$-th layer of the tree. For each $$$i$$$ from $$$0$$$ to $$$d - 1$$$, for each vertex of the $$$i$$$-th layer, do the following. If the cur...
2,900
true
false
false
true
false
false
false
false
false
false
147
431B
Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower in the morning. That's why every morning there is a line of five people in front of the dormitory s...
1,200
false
false
true
false
false
false
true
false
false
false
8,118
1622A
There are three sticks with integer lengths $$$l_1, l_2$$$ and $$$l_3$$$. You are asked to break exactly one of them into two pieces in such a way that: both pieces have positive (strictly greater than $$$0$$$) integer length; the total length of the pieces is equal to the original length of the stick; it's possible...
800
true
false
false
false
false
false
false
false
false
false
2,511
980F
You are given a special connected undirected graph where each vertex belongs to at most one simple cycle. Your task is to remove as many edges as needed to convert this graph into a tree (connected graph with no cycles). For each node, independently, output the maximum distance between it and a leaf in the resulting tr...
2,900
false
false
false
true
false
false
false
false
false
true
5,801
525B
Problem - 525B - 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
true
false
false
false
true
false
false
false
false
7,735
1842C
Enjoy erasing Tenzing, identified as Accepted! Tenzing has $$$n$$$ balls arranged in a line. The color of the $$$i$$$-th ball from the left is $$$a_i$$$. Tenzing can do the following operation any number of times: select $$$i$$$ and $$$j$$$ such that $$$1leq i < j leq a$$$ and $$$a_i=a_j$$$, remove $$$a_i,a_{i+1},ldo...
1,500
false
false
false
true
false
false
false
false
false
false
1,237
185D
The Great Mushroom King descended to the dwarves, but not everyone managed to see him. Only the few chosen ones could see the King. We know that only _LCM_(_k_2_l_u2009+u20091,u2009_k_2_l_u2009+u20091u2009+u20091,u2009...,u2009_k_2_r_u2009+u20091) dwarves can see the Great Mushroom King. Numbers _k_, _l_, _r_ are chose...
2,600
true
false
false
false
false
false
false
false
false
false
9,101
99B
In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup...
1,300
false
false
true
false
false
false
false
false
true
false
9,490
317E
Princess Vlada enjoys springing in the meadows and walking in the forest. One day β€” wonderful, sunny day β€” during her walk Princess found out with astonishment that her shadow was missing! "Blimey!", β€” she thought and started her search of the shadow in the forest. Normally the Shadow is too lazy and simply sleeps unde...
3,100
false
false
false
false
false
true
false
false
false
false
8,561
1380C
Problem - 1380C - 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,400
false
true
true
true
false
false
true
false
true
false
3,769
1834C
Alice and Bob are playing a game. They have two strings $$$S$$$ and $$$T$$$ of the same length $$$n$$$ consisting of lowercase latin letters. Players take turns alternately, with Alice going first. On her turn, Alice chooses an integer $$$i$$$ from $$$1$$$ to $$$n$$$, one of the strings $$$S$$$ or $$$T$$$, and any lowe...
1,200
true
true
false
false
false
false
false
false
false
false
1,282
993C
There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer $$$y$$$-coordinates, and their $$$x$$$-coordinate is equal to $$$-100$$$, while the second group is posit...
2,100
false
false
false
false
false
false
true
false
false
false
5,732
1804F
Jack has a graph of $$$n$$$ vertices and $$$m$$$ edges. All edges are bidirectional and of unit length. The graph is connected, i.xa0e. there exists a path between any two of its vertices. There can be more than one edge connecting the same pair of vertices. The graph can contain self-loops, i.xa0e. edges connecting a ...
2,700
false
false
false
false
false
false
false
true
false
true
1,452
1059B
Student Andrey has been skipping physical education lessons for the whole term, and now he must somehow get a passing grade on this subject. Obviously, it is impossible to do this by legal means, but Andrey doesn't give up. Having obtained an empty certificate from a local hospital, he is going to use his knowledge of ...
1,300
false
false
true
false
false
false
false
false
false
false
5,420
1833B
You are given an array $$$a$$$ containing the weather forecast for Berlandia for the last $$$n$$$ days. That is, $$$a_i$$$xa0β€” is the estimated air temperature on day $$$i$$$ ($$$1 le i le n$$$). You are also given an array $$$b$$$xa0β€” the air temperature that was actually present on each of the days. However, all the ...
900
false
true
false
false
false
false
false
false
true
false
1,290
1717A
Madoka is a very strange girl, and therefore she suddenly wondered how many pairs of integers $$$(a, b)$$$ exist, where $$$1 leq a, b leq n$$$, for which $$$frac{operatorname{lcm}(a, b)}{operatorname{gcd}(a, b)} leq 3$$$. In this problem, $$$operatorname{gcd}(a, b)$$$ denotes $$$ denotes xa0β€” the number of test cases. ...
800
true
false
false
false
false
false
false
false
false
false
1,981
216C
A new Berland businessman Vitaly is going to open a household appliances' store. All he's got to do now is to hire the staff. The store will work seven days a week, but not around the clock. Every day at least _k_ people must work in the store. Berland has a law that determines the order of working days and non-working...
1,800
false
true
false
false
false
false
false
false
false
false
8,974
573E
Limak is an old brown bear. He often goes bowling with his friends. Today he feels really good and tries to beat his own record! For rolling a ball one gets a score β€” an integer (maybe negative) number of points. Score for _i_-th roll is multiplied by _i_ and scores are summed up. So, for _k_ rolls with scores _s_1,u20...
3,200
false
true
false
false
true
false
false
false
false
false
7,555
1093F
Vasya has got an array consisting of $$$n$$$ integers, and two integers $$$k$$$ and $$$len$$$ in addition. All numbers in the array are either between $$$1$$$ and $$$k$$$ (inclusive), or equal to $$$-1$$$. The array is good if there is no segment of $$$len$$$ consecutive equal numbers. Vasya will replace each $$$-1$$$ ...
2,400
false
false
false
true
false
false
false
false
false
false
5,239
339C
Xenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first weight goes on the left scalepan, the second weight goes on the right scalepan, the third one goes ...
1,700
false
true
false
true
false
true
false
false
false
true
8,478
1056F
Polycarp, Arkady's friend, prepares to the programming competition and decides to write a contest. The contest consists of $$$n$$$ problems and lasts for $$$T$$$ minutes. Each of the problems is defined by two positive integers $$$a_i$$$ and $$$p_i$$$xa0β€” its difficulty and the score awarded by its solution. Polycarp's...
2,500
true
false
false
true
false
false
false
true
false
false
5,427
1198E
There is a square grid of size $$$n imes n$$$. Some cells are colored in black, all others are colored in white. In one operation you can select some rectangle and color all its cells in white. It costs $$$min(h, w)$$$ to color a rectangle of size $$$h imes w$$$. You are to make all cells white for minimum total cost...
2,500
false
false
false
false
false
false
false
false
false
true
4,705