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
1061C
You are given an integer array $$$a_1, a_2, ldots, a_n$$$. The array $$$b$$$ is called to be a subsequence of $$$a$$$ if it is possible to remove some elements from $$$a$$$ to get $$$b$$$. Array $$$b_1, b_2, ldots, b_k$$$ is called to be good if it is not empty and for every $$$i$$$ ($$$1 le i le k$$$) $$$b_i$$$ is div...
1,700
true
false
true
true
true
false
false
false
false
false
5,406
908F
Roy and Biv have a set of _n_ points on the infinite number line. Each point has one of 3 colors: red, green, or blue. Roy and Biv would like to connect all the points with some edges. Edges can be drawn between any of the two of the given points. The cost of an edge is equal to the distance between the two points it c...
2,400
false
true
true
false
false
false
false
false
false
true
6,115
1795D
You are given an undirected graph consisting of $$$n$$$ vertices and $$$n$$$ edges, where $$$n$$$ is divisible by $$$6$$$. Each edge has a weight, which is a positive (greater than zero) integer. The graph has the following structure: it is split into $$$frac{n}{3}$$$ triples of vertices, the first triple consisting of...
1,600
true
false
false
false
false
false
false
false
false
false
1,506
1139C
You are given a tree (a connected undirected graph without cycles) of $$$n$$$ vertices. Each of the $$$n - 1$$$ edges of the tree is colored in either black or red. You are also given an integer $$$k$$$. Consider sequences of $$$k$$$ vertices. Let's call a sequence $$$[a_1, a_2, ldots, a_k]$$$ good if it satisfies the ...
1,500
true
false
false
false
false
false
false
false
false
true
5,032
1183C
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$. During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
1,400
true
false
false
false
false
false
false
true
false
false
4,800
282A
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated. The language is that peculiar as it has exactly one variable, called _x_. Also, there are two operations: Operation ++ increases the value of variable _x_ by 1. Operation -- decreases the value of variable _x_ by 1. A ...
800
false
false
true
false
false
false
false
false
false
false
8,708
2023A
You are given $$$n$$$ arrays $$$a_1$$$, $$$ldots$$$, $$$a_n$$$. The length of each array is two. Thus, $$$a_i = [a_{i, 1}, a_{i, 2}]$$$. You need to concatenate the arrays into a single array of length $$$2n$$$ such that the number of inversions$$$^{dagger}$$$ in the resulting array is minimized. Note that you do not n...
1,300
true
true
false
false
false
true
false
false
true
false
131
1396A
You are given an array $$$a$$$ of $$$n$$$ integers. You want to make all elements of $$$a$$$ equal to zero by doing the following operation exactly three times: Select a segment, for each number in this segment we can add a multiple of $$$len$$$ to it, where $$$len$$$ is the length of this segment (added integers can ...
1,600
false
true
false
false
false
true
false
false
false
false
3,693
414B
Problem - 414B - 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
false
false
false
true
false
false
false
false
false
false
8,168
1209G1
This is an easier version of the next problem. In this version, $$$q = 0$$$. A sequence of integers is called nice if its elements are arranged in blocks like in $$$[3, 3, 3, 4, 1, 1]$$$. Formally, if two elements are equal, everything in between must also be equal. Let's define difficulty of a sequence as a minimum po...
2,000
false
true
true
false
true
false
false
false
false
false
4,639
1611E1
The only difference with E2 is the question of the problem.. Vlad built a maze out of $$$n$$$ rooms and $$$n-1$$$ bidirectional corridors. From any room $$$u$$$ any other room $$$v$$$ can be reached through a sequence of corridors. Thus, the room system forms an undirected tree. Vlad invited $$$k$$$ friends to play a g...
1,700
false
true
false
false
false
false
false
false
false
false
2,587
1336E2
This is the hard version of the problem. The only difference between easy and hard versions is the constraint of $$$m$$$. You can make hacks only if both versions are solved. Chiori loves dolls and now she is going to decorate her bedroom! xa0As a doll collector, Chiori has got $$$n$$$ dolls. The $$$i$$$-th doll has a ...
3,500
true
false
false
false
false
false
true
false
false
false
4,018
1109C
Fedya and Sasha are friends, that's why Sasha knows everything about Fedya. Fedya keeps his patience in an infinitely large bowl. But, unlike the bowl, Fedya's patience isn't infinite, that is why let $$$v$$$ be the number of liters of Fedya's patience, and, as soon as $$$v$$$ becomes equal to $$$0$$$, the bowl will bu...
2,800
false
false
true
false
true
false
false
true
false
false
5,153
856C
It is Borya's eleventh birthday, and he has got a great present: _n_ cards with numbers. The _i_-th card has the number _a__i_ written on it. Borya wants to put his cards in a row to get one greater number. For example, if Borya has cards with numbers 1, 31, and 12, and he puts them in a row in this order, he would get...
2,400
true
false
false
true
false
false
false
false
false
false
6,318
45F
Once Vasya needed to transport _m_ goats and _m_ wolves from riverbank to the other as quickly as possible. The boat can hold _n_ animals and Vasya, in addition, he is permitted to put less than _n_ animals in the boat. If in one place (on one of the banks or in the boat) the wolves happen to strictly outnumber the goa...
2,500
false
true
false
false
false
false
false
false
false
false
9,754
1786A2
This is a hard version of the problem. In this version, there are two colors of the cards. Alice has $$$n$$$ cards, each card is either black or white. The cards are stacked in a deck in such a way that the card colors alternate, starting from a white card. Alice deals the cards to herself and to Bob, dealing at once s...
800
false
false
true
false
false
false
false
false
false
false
1,565
898D
Every evening Vitalya sets _n_ alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer _a__i_xa0β€” number of minute after midnight in which it rings. Every alarm clock begins ringing at the beginning of the minute and rings during whole minute. Vitalya will...
1,600
false
true
false
false
false
false
false
false
false
false
6,155
1375G
You are given a tree with $$$n$$$ vertices. You are allowed to modify the structure of the tree through the following multi-step operation: 1. Choose three vertices $$$a$$$, $$$b$$$, and $$$c$$$ such that $$$b$$$ is adjacent to both $$$a$$$ and $$$c$$$. 2. For every vertex $$$d$$$ other than $$$b$$$ that is adjacent to...
2,800
false
false
false
false
false
true
true
false
false
true
3,781
1292C
On another floor of the A.R.C. Markland-N, the young man Simon "Xenon" Jackson, takes a break after finishing his project early (as always). Having a lot of free time, he decides to put on his legendary hacker "X" instinct and fight against the gangs of the cyber world. His target is a network of $$$n$$$ small gangs. T...
2,300
false
true
false
true
false
false
false
false
false
false
4,235
2035H
I'm peakly productive and this is deep. You are given two permutations$$$^{ ext{βˆ—}}$$$ $$$a$$$ and $$$b$$$, both of length $$$n$$$. You can perform the following three-step operation on permutation $$$a$$$: 1. Choose an index $$$i$$$ ($$$1 le i le n$$$). 2. Cyclic shift $$$a_1, a_2, ldots, a_{i-1}$$$ by $$$1$$$ to the ...
3,500
false
false
false
false
false
true
false
false
false
false
53
437E
This time our child has a simple polygon. He has to find the number of ways to split the polygon into non-degenerate triangles, each way must satisfy the following requirements: each vertex of each triangle is one of the polygon vertex; each side of the polygon must be the side of exactly one triangle; the area of i...
2,500
false
false
false
true
false
false
false
false
false
false
8,087
1890B
Qingshan has a string $$$s$$$, while Daniel has a string $$$t$$$. Both strings only contain $$$ exttt{0}$$$ and $$$ exttt{1}$$$. A string $$$a$$$ of length $$$k$$$ is good if and only if $$$a_i e a_{i+1}$$$ for all $$$i=1,2,ldots,k-1$$$. For example, $$$ exttt{1}$$$, $$$ exttt{101}$$$, $$$ exttt{0101}$$$ are good, wh...
800
false
false
true
false
false
true
false
false
false
false
958
1572D
There are currently $$$n$$$ hot topics numbered from $$$0$$$ to $$$n-1$$$ at your local bridge club and $$$2^n$$$ players numbered from $$$0$$$ to $$$2^n-1$$$. Each player holds a different set of views on those $$$n$$$ topics, more specifically, the $$$i$$$-th player holds a positive view on the $$$j$$$-th topic if $$...
2,800
false
true
false
false
false
false
false
false
false
true
2,779
1955H
You are playing a very popular Tower Defense game called "Runnerfield 2". In this game, the player sets up defensive towers that attack enemies moving from a certain starting point to the player's base. You are given a grid of size $$$n imes m$$$, on which $$$k$$$ towers are already placed and a path is laid out throu...
2,300
false
false
false
true
false
true
true
false
false
false
541
1463C
You have a robot that can move along a number line. At time moment $$$0$$$ it stands at point $$$0$$$. You give $$$n$$$ commands to the robot: at time $$$t_i$$$ seconds you command the robot to go to point $$$x_i$$$. Whenever the robot receives a command, it starts moving towards the point $$$x_i$$$ with the speed of $...
1,800
false
false
true
false
false
false
false
false
false
false
3,371
1505F
. Output Output the result – an integer number.
2,200
true
false
false
false
false
false
false
false
false
false
3,147
1793E
The famous writer Velepin is very productive. Recently, he signed a contract with a well-known publication and now he needs to write $$$k_i$$$ books for $$$i$$$-th year. This is not a problem for him at all, he can write as much as he wants about samurai, space, emptiness, insects and werewolves. He has $$$n$$$ regular...
2,600
false
true
false
true
true
false
false
true
true
false
1,516
2021C2
This is the hard version of the problem. In the two versions, the constraints on $$$q$$$ and the time limit are different. In this version, $$$0 leq q leq 2 cdot 10^5$$$. You can make hacks only if all the versions of the problem are solved. A team consisting of $$$n$$$ members, numbered from $$$1$$$ to $$$n$$$, is set...
1,900
false
true
true
false
true
true
false
false
true
false
143
1707F
A transformation of an array of positive integers $$$a_1,a_2,dots,a_n$$$ is defined by replacing $$$a$$$ with the array $$$b_1,b_2,dots,b_n$$$ given by $$$b_i=a_ioplus a_{(ibmod n)+1}$$$, where $$$oplus$$$ denotes the bitwise XOR operation. You are given integers $$$n$$$, $$$t$$$, and $$$w$$$. We consider an array $$$c...
3,500
false
false
false
true
false
true
false
false
false
false
2,029
1620B
A rectangle with its opposite corners in $$$(0, 0)$$$ and $$$(w, h)$$$ and sides parallel to the axes is drawn on a plane. You are given a list of lattice points such that each point lies on a side of a rectangle but not in its corner. Also, there are at least two points on every side of a rectangle. Your task is to ch...
1,000
true
true
false
false
false
false
false
false
false
false
2,526
1455C
Alice and Bob play ping-pong with simplified rules. During the game, the player serving the ball commences a play. The server strikes the ball then the receiver makes a return by hitting the ball back. Thereafter, the server and receiver must alternately make a return until one of them doesn't make a return. The one wh...
1,100
true
false
false
false
false
true
false
false
false
false
3,400
2026A
You are given a coordinate plane and three integers $$$X$$$, $$$Y$$$, and $$$K$$$. Find two line segments $$$AB$$$ and $$$CD$$$ such that 1. the coordinates of points $$$A$$$, $$$B$$$, $$$C$$$, and $$$D$$$ are integers; 2. $$$0 le A_x, B_x, C_x, D_x le X$$$ and $$$0 le A_y, B_y, C_y, D_y le Y$$$; 3. the length of segme...
900
true
true
false
false
false
true
false
false
false
false
116
1158B
Let $$$s$$$ be some string consisting of symbols "0" or "1". Let's call a string $$$t$$$ a substring of string $$$s$$$, if there exists such number $$$1 leq l leq s - t + 1$$$ that $$$t = s_l s_{l+1} ldots s_{l + t - 1}$$$. Let's call a substring $$$t$$$ of string $$$s$$$ unique, if there exist only one such $$$l$$$. F...
2,200
true
false
false
false
false
true
false
false
false
false
4,914
1152F1
This problem is same as the next one, but has smaller constraints. Aki is playing a new video game. In the video game, he will control Neko, the giant cat, to fly between planets in the Catniverse. There are $$$n$$$ planets in the Catniverse, numbered from $$$1$$$ to $$$n$$$. At the beginning of the game, Aki chooses t...
2,800
false
false
false
true
false
false
false
false
false
false
4,951
1444B
You are given an array $$$a$$$ of length $$$2n$$$. Consider a partition of array $$$a$$$ into two subsequences $$$p$$$ and $$$q$$$ of length $$$n$$$ each (each element of array $$$a$$$ should be in exactly one subsequence: either in $$$p$$$ or in $$$q$$$). Let's sort $$$p$$$ in non-decreasing order, and $$$q$$$ in non-...
1,900
true
false
false
false
false
false
false
false
true
false
3,453
1132D
Berland SU holds yet another training contest for its students today. $$$n$$$ students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers! Let students be numbered from $$$1$$$ to $$$n$$$. Laptop of the $$$i$$$-th student has charge $$$a_i$$$ at the beginning of the co...
2,300
false
true
false
false
false
false
false
true
false
false
5,058
130B
Problem - 130B - Codeforces =============== xa0 and 126 (tilde), inclusive. Output Output the characters of this string in reverse order. Examples Input secrofedoc Output codeforces Input !ssalg-gnikool5 Output 5looking-glass!
1,400
false
false
true
false
false
false
false
false
false
false
9,362
459B
Pashmak decided to give Parmida a pair of flowers from the garden. There are _n_ flowers in the garden and the _i_-th of them has a beauty number _b__i_. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers necessarily. She wants to have those pairs of flowers that their beauty diff...
1,300
false
false
true
false
false
false
false
false
true
false
8,005
1163C2
This problem is same as the previous one, but has larger constraints. It was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). After arriving at the power station, the cats got impressed with a large power transmission system co...
1,900
true
false
true
false
true
false
false
false
false
false
4,900
915B
Luba is surfing the Internet. She currently has _n_ opened tabs in her browser, indexed from 1 to _n_ from left to right. The mouse cursor is currently located at the _pos_-th tab. Luba needs to use the tabs with indices from _l_ to _r_ (inclusive) for her studies, and she wants to close all the tabs that don't belong ...
1,300
false
false
true
false
false
false
false
false
false
false
6,074
1437D
Monocarp had a tree which consisted of $$$n$$$ vertices and was rooted at vertex $$$1$$$. He decided to study BFS (q.put(1) # place the root at the end of the queuewhile not q.empty(): k = q.pop() # retrieve the first vertex from the queue a.append(k) # append k to the end of the sequence in which vertices were visited...
1,600
false
true
false
false
false
false
false
false
false
true
3,482
1029B
You are given a problemset consisting of $$$n$$$ problems. The difficulty of the $$$i$$$-th problem is $$$a_i$$$. It is guaranteed that all difficulties are distinct and are given in the increasing order. You have to assemble the contest which consists of some problems of the given problemset. In other words, the conte...
1,200
true
true
false
true
false
false
false
false
false
false
5,560
363E
Let's assume that we are given an _n_u2009Γ—u2009_m_ table filled by integers. We'll mark a cell in the _i_-th row and _j_-th column as (_i_,u2009_j_). Thus, (1,u20091) is the upper left cell of the table and (_n_,u2009_m_) is the lower right cell. We'll assume that a circle of radius _r_ with the center in cell (_i_0,u...
2,500
false
false
true
false
true
false
true
false
false
false
8,378
260C
Little Vasya had _n_ boxes with balls in the room. The boxes stood in a row and were numbered with numbers from 1 to _n_ from left to right. Once Vasya chose one of the boxes, let's assume that its number is _i_, took all balls out from it (it is guaranteed that this box originally had at least one ball), and began put...
1,700
false
true
true
false
false
true
false
false
false
false
8,793
1054E
Egor came up with a new chips puzzle and suggests you to play. The puzzle has the form of a table with $$$n$$$ rows and $$$m$$$ columns, each cell can contain several black or white chips placed in a row. Thus, the state of the cell can be described by a string consisting of characters '0' (a white chip) and '1' (a bla...
2,400
true
false
true
false
false
true
false
false
false
false
5,443
446B
As we know, DZY loves playing games. One day DZY decided to play with a _n_u2009Γ—u2009_m_ matrix. To be more precise, he decided to modify the matrix with exactly _k_ operations. Each modification is one of the following: 1. Pick some row of the matrix and decrease each element of the row by _p_. This operation brings ...
2,000
false
true
false
false
true
false
true
false
false
false
8,055
223A
Problem - 223A - 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
true
false
false
false
false
false
8,947
1451D
Utkarsh is forced to play yet another one of Ashish's games. The game progresses turn by turn and as usual, Ashish moves first. Consider the 2D plane. There is a token which is initially at $$$(0,0)$$$. In one move a player must increase either the $$$x$$$ coordinate or the $$$y$$$ coordinate of the token by exactly $$...
1,700
true
false
false
false
false
false
false
false
false
false
3,425
628D
Consider the decimal presentation of an integer. Let's call a number d-magic if digit _d_ appears in decimal presentation of the number on even positions and nowhere else. For example, the numbers 1727374, 17, 1 are 7-magic but 77, 7, 123, 34, 71 are not 7-magic. On the other hand the number 7 is 0-magic, 123 is 2-magi...
2,200
false
false
false
true
false
false
false
false
false
false
7,312
1970F3
This afternoon, you decided to enjoy the first days of Spring by taking a walk outside. As you come near the Quidditch field, you hear screams. Once again, there is a conflict about the score: the two teams are convinced that they won the game! To prevent this problem from happening one more time, you decide to get inv...
2,300
false
false
true
false
false
false
false
false
false
false
469
1344D
Uh oh! Applications to tech companies are due soon, and you've been procrastinating by doing contests instead! (Let's pretend for now that it is actually possible to get a job in these uncertain times.) You have completed many programming projects. In fact, there are exactly $$$n$$$ types of programming projects, and y...
2,700
true
true
false
false
false
false
false
true
false
false
3,984
257A
Vasya has got many devices that work on electricity. He's got _n_ supply-line filters to plug the devices, the _i_-th supply-line filter has _a__i_ sockets. Overall Vasya has got _m_ devices and _k_ electrical sockets in his flat, he can plug the devices or supply-line filters directly. Of course, he can plug the suppl...
1,100
false
true
true
false
false
false
false
false
true
false
8,807
185C
The Fat Rat and his friend Π‘erealguy have had a bet whether at least a few oats are going to descend to them by some clever construction. The figure below shows the clever construction. A more formal description of the clever construction is as follows. The clever construction consists of _n_ rows with scales. The firs...
2,500
false
false
false
true
false
false
false
false
false
false
9,102
1542E1
Problem - 1542E1 - 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,400
true
false
false
true
false
false
false
false
false
false
2,930
1928F
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 924 (Div. 2) Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If...
2,900
true
false
true
false
true
false
false
false
false
false
718
730G
Polycarp starts his own business. Tomorrow will be the first working day of his car repair shop. For now the car repair shop is very small and only one car can be repaired at a given time. Polycarp is good at marketing, so he has already collected _n_ requests from clients. The requests are numbered from 1 to _n_ in or...
1,600
false
false
true
false
false
false
false
false
false
false
6,882
1148B
Arkady bought an air ticket from a city A to a city C. Unfortunately, there are no direct flights, but there are a lot of flights from A to a city B, and from B to C. There are $$$n$$$ flights from A to B, they depart at time moments $$$a_1$$$, $$$a_2$$$, $$$a_3$$$, ..., $$$a_n$$$ and arrive at B $$$t_a$$$ moments late...
1,600
false
false
false
false
false
false
true
true
false
false
4,976
1867C
This is an interactive problem! salyg1n gave Alice a set $$$S$$$ of $$$n$$$ distinct integers $$$s_1, s_2, ldots, s_n$$$ ($$$0 leq s_i leq 10^9$$$). Alice decided to play a game with this set against Bob. The rules of the game are as follows: Players take turns, with Alice going first. In one move, Alice adds one num...
1,300
false
true
false
false
true
true
false
false
false
false
1,073
1980F1
This is an easy version of the problem; it differs from the hard version only by the question. The easy version only needs you to print whether some values are non-zero or not. The hard version needs you to print the exact values. Alice and Bob are dividing the field. The field is a rectangle of size $$$n imes m$$$ ($...
1,900
true
false
false
false
true
false
false
false
true
false
405
1409B
You are given four integers $$$a$$$, $$$b$$$, $$$x$$$ and $$$y$$$. Initially, $$$a ge x$$$ and $$$b ge y$$$. You can do the following operation no more than $$$n$$$ times: Choose either $$$a$$$ or $$$b$$$ and decrease it by one. However, as a result of this operation, value of $$$a$$$ cannot become less than $$$x$$$, ...
1,100
true
true
false
false
false
false
true
false
false
false
3,626
1784D
$$$2^n$$$ people, numbered with distinct integers from $$$1$$$ to $$$2^n$$$, are playing in a single elimination tournament. The bracket of the tournament is a full binary tree of height $$$n$$$ with $$$2^n$$$ leaves. When two players meet each other in a match, a player with the smaller number always wins. The winner ...
2,400
false
false
false
true
false
false
false
false
false
false
1,569
1650A
The string $$$s$$$ is given, the string length is odd number. The string consists of lowercase letters of the Latin alphabet. As long as the string length is greater than $$$1$$$, the following operation can be performed on it: select any two adjacent letters in the string $$$s$$$ and delete them from the string. For e...
800
false
false
true
false
false
false
false
false
false
false
2,375
1619B
Problem - 1619B - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
true
false
true
false
false
false
false
false
false
false
2,534
1868B2
This is the hard version of the problem. The only difference is that in this version everyone must give candies to no more than one person and receive candies from no more than one person. Note that a submission cannot pass both versions of the problem at the same time. You can make hacks only if both versions of the p...
2,100
true
true
true
true
false
true
false
false
false
false
1,066
1300A
Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 le i le n$$$) and do $$$a_i := a_i + 1$$$. If either the sum or the product of all elements in ...
800
true
false
true
false
false
false
false
false
false
false
4,196
1499E
You are given two strings $$$x$$$ and $$$y$$$, both consist only of lowercase Latin letters. Let $$$s$$$ be the length of string $$$s$$$. Let's call a sequence $$$a$$$ a merging sequence if it consists of exactly $$$x$$$ zeros and exactly $$$y$$$ ones in some order. A merge $$$z$$$ is produced from a sequence $$$a$$$ b...
2,400
true
false
false
true
false
false
false
false
false
false
3,171
1415E
Wabbit is playing a game with $$$n$$$ bosses numbered from $$$1$$$ to $$$n$$$. The bosses can be fought in any order. Each boss needs to be defeated exactly once. There is a parameter called boss bonus which is initially $$$0$$$. When the $$$i$$$-th boss is defeated, the current boss bonus is added to Wabbit's score, a...
2,200
true
true
false
false
false
true
false
false
false
false
3,604
1108E2
The only difference between easy and hard versions is a number of elements in the array. You are given an array $$$a$$$ consisting of $$$n$$$ integers. The value of the $$$i$$$-th element of the array is $$$a_i$$$. You are also given a set of $$$m$$$ segments. The $$$j$$$-th segment is $$$[l_j; r_j]$$$, where $$$1 le l...
2,100
false
false
true
false
true
false
false
false
false
false
5,157
1817A
A sequence is almost-increasing if it does not contain three consecutive elements $$$x, y, z$$$ such that $$$xge yge z$$$. You are given an array $$$a_1, a_2, dots, a_n$$$ and $$$q$$$ queries. Each query consists of two integers $$$1le lle rle n$$$. For each query, find the length of the longest almost-increasing subse...
1,500
false
true
false
false
true
false
false
true
false
false
1,373
1726F
This problem was copied by the author from another online platform. Codeforces strongly condemns this action and therefore further submissions to this problem are not accepted. Debajyoti has a very important meeting to attend and he is already very late. Harsh, his driver, needs to take Debajyoti to the destination for...
2,900
false
true
false
false
true
false
false
false
false
false
1,928
1519E
There are $$$n$$$ points on an infinite plane. The $$$i$$$-th point has coordinates $$$(x_i, y_i)$$$ such that $$$x_i > 0$$$ and $$$y_i > 0$$$. The coordinates are not necessarily integer. In one move you perform the following operations: choose two points $$$a$$$ and $$$b$$$ ($$$a eq b$$$); move point $$$a$$$ from ...
2,700
false
false
false
false
false
true
false
false
true
true
3,065
1239C
There are $$$n$$$ seats in the train's car and there is exactly one passenger occupying every seat. The seats are numbered from $$$1$$$ to $$$n$$$ from left to right. The trip is long, so each passenger will become hungry at some moment of time and will go to take boiled water for his noodles. The person at seat $$$i$$...
2,300
false
true
true
false
true
false
false
false
false
false
4,494
1592B
Hemose was shopping with his friends Samez, AhmedZ, AshrafEzz, TheSawan and O_E in Germany. As you know, Hemose and his friends are problem solvers, so they are very clever. Therefore, they will go to all discount markets in Germany. Hemose has an array of $$$n$$$ integers. He wants Samez to sort the array in the non-d...
1,200
true
false
false
false
false
true
false
false
true
false
2,692
194A
One day the Codeforces round author sat exams. He had _n_ exams and he needed to get an integer from 2 to 5 for each exam. He will have to re-sit each failed exam, i.e. the exam that gets mark 2. The author would need to spend too much time and effort to make the sum of his marks strictly more than _k_. That could have...
900
true
false
true
false
false
false
false
false
false
false
9,065
1712B
I wonder, does the falling rain Forever yearn for it's disdain? Effluvium of the Mind You are given a positive integer $$$n$$$. Find any permutation $$$p$$$ of length $$$n$$$ such that the sum $$$operatorname{lcm}(1,p_1) + operatorname{lcm}(2, p_2) + ldots + operatorname{lcm}(n, p_n)$$$ is as large as possible. Here $$...
800
false
true
false
false
false
true
false
false
false
false
2,012
14C
Problem - 14C - 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,700
true
false
true
false
false
true
true
false
false
false
9,923
1983G
You are given a tree with $$$n$$$ nodes numbered from $$$1$$$ to $$$n$$$, along with an array of size $$$n$$$. The value of $$$i$$$-th node is $$$a_{i}$$$. There are $$$q$$$ queries. In each query, you are given 2 nodes numbered as $$$x$$$ and $$$y$$$. Consider the path from the node numbered as $$$x$$$ to the node num...
3,000
false
false
false
true
false
false
true
false
false
false
384
1843D
Timofey has an apple tree growing in his garden; it is a rooted tree of $$$n$$$ vertices with the root in vertex $$$1$$$ (the vertices are numbered from $$$1$$$ to $$$n$$$). A tree is a connected graph without loops and multiple edges. This tree is very unusualxa0β€” it grows with its root upwards. However, it's quite no...
1,200
true
false
false
true
false
false
false
false
false
false
1,227
732C
Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! Every day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, in this order). The only thing that Vasiliy has now is a card from the dining room contaning notes how ...
1,200
true
true
true
false
false
true
false
true
false
false
6,868
797E
Problem - 797E - Codeforces =============== xa0 . The second line contains _n_ integers β€” elements of _a_ (1u2009≀u2009_a__i_u2009≀u2009_n_ for each _i_ from 1 to _n_). The third line containts one integer _q_ (1u2009≀u2009_q_u2009≀u2009100000). Then _q_ lines follow. Each line contains the values of _p_ ...
2,000
false
false
false
true
true
false
true
false
false
false
6,583
1097H
A Thue-Morse-Radecki-Mateusz sequence (Thorse-Radewoosh sequence in short) is an infinite sequence constructed from a finite sequence $$$mathrm{gen}$$$ of length $$$d$$$ and an integer $$$m$$$, obtained in the following sequence of steps: In the beginning, we define the one-element sequence $$$M_0=(0)$$$. In the $$$k...
3,400
false
false
false
true
false
false
true
false
false
false
5,217
986A
Some company is going to hold a fair in Byteland. There are $$$n$$$ towns in Byteland and $$$m$$$ two-way roads between towns. Of course, you can reach any town from any other town using roads. There are $$$k$$$ types of goods produced in Byteland and every town produces only one type. To hold a fair you have to bring ...
1,600
false
true
false
false
false
false
false
false
false
true
5,772
296B
Yaroslav thinks that two strings _s_ and _w_, consisting of digits and having length _n_ are non-comparable if there are two numbers, _i_ and _j_ (1u2009≀u2009_i_,u2009_j_u2009≀u2009_n_), such that _s__i_u2009>u2009_w__i_ and _s__j_u2009<u2009_w__j_. Here sign _s__i_ represents the _i_-th digit of string _s_, similarly...
2,000
false
false
false
true
false
false
false
false
false
false
8,645
1244F
There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw...
2,300
false
false
true
false
false
true
false
false
false
false
4,476
1213D1
Problem - 1213D1 - 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
false
true
false
false
false
true
false
false
false
4,616
729F
This problem has unusual memory constraint. At evening, Igor and Zhenya the financiers became boring, so they decided to play a game. They prepared _n_ papers with the income of some company for some time periods. Note that the income can be positive, zero or negative. Igor and Zhenya placed the papers in a row and dec...
2,500
false
false
false
true
false
false
false
false
false
false
6,889
302B
Eugeny loves listening to music. He has _n_ songs in his play list. We know that song number _i_ has the duration of _t__i_ minutes. Eugeny listens to each song, perhaps more than once. He listens to song number _i_ _c__i_ times. Eugeny's play list is organized as follows: first song number 1 plays _c_1 times, then son...
1,200
false
false
true
false
false
false
false
true
false
false
8,624
2013A
Today, a club fair was held at "NSPhM". In order to advertise his pastry club, Zhan decided to demonstrate the power of his blender. To demonstrate the power of his blender, Zhan has $$$n$$$ fruits. The blender can mix up to $$$x$$$ fruits per second. In each second, Zhan can put up to $$$y$$$ fruits into the blender. ...
800
true
false
false
false
false
true
false
false
false
false
178
1712E2
We are sum for we are many Some Number This version of the problem differs from the previous one only in the constraint on $$$t$$$. You can make hacks only if both versions of the problem are solved. You are given two positive integers $$$l$$$ and $$$r$$$. Count the number of distinct triplets of integers $$$(i, j, k)$...
2,500
true
false
false
false
true
false
true
false
false
false
2,008
1850H
In order to win his toughest battle, Mircea came up with a great strategy for his army. He has $$$n$$$ soldiers and decided to arrange them in a certain way in camps. Each soldier has to belong to exactly one camp, and there is one camp at each integer point on the $$$x$$$-axis (at points $$$cdots, -2, -1, 0, 1, 2, cdo...
1,700
false
true
true
false
false
false
false
false
false
true
1,175
82C
The Berland Kingdom is a set of _n_ cities connected with each other with _n_u2009-u20091 railways. Each road connects exactly two different cities. The capital is located in city 1. For each city there is a way to get from there to the capital by rail. In the _i_-th city there is a soldier division number _i_, each di...
2,000
false
false
false
false
true
false
false
false
true
false
9,556
1409A
You are given two integers $$$a$$$ and $$$b$$$. In one move, you can choose some integer $$$k$$$ from $$$1$$$ to $$$10$$$ and add it to $$$a$$$ or subtract it from $$$a$$$. In other words, you choose an integer $$$k in [1; 10]$$$ and perform $$$a := a + k$$$ or $$$a := a - k$$$. You may use different values of $$$k$$$ ...
800
true
true
false
false
false
false
false
false
false
false
3,627
1775A2
This is an hard version of the problem. The difference between the versions is that the string can be longer than in the easy version. You can only do hacks if both versions of the problem are passed. Kazimir Kazimirovich is a Martian gardener. He has a huge orchard of binary balanced apple trees. Recently Casimir deci...
900
false
true
false
false
false
true
false
false
false
false
1,634
1635A
You are given an array $$$a$$$ of size $$$n$$$. You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 leq i < j leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i a_j = x y$$$ must be held, where $$$$$$ denotes ...
800
false
true
false
false
false
false
false
false
false
false
2,440
150C
I guess there's not much point in reminding you that Nvodsk winters aren't exactly hot. That increased the popularity of the public transport dramatically. The route of bus 62 has exactly _n_ stops (stop 1 goes first on its way and stop _n_ goes last). The stops are positioned on a straight line and their coordinates a...
2,200
true
false
false
false
true
false
false
false
false
false
9,274
1804E
Ada operates a network that consists of $$$n$$$ servers and $$$m$$$ direct connections between them. Each direct connection between a pair of distinct servers allows bidirectional transmission of information between these two servers. Ada knows that these $$$m$$$ direct connections allow to directly or indirectly trans...
2,400
false
false
false
true
false
false
true
false
false
true
1,453
571A
Problem - 571A - 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
true
false
false
false
false
false
false
false
7,566
958C1
Rebel spy Heidi has just obtained the plans for the Death Star from the Empire and, now on her way to safety, she is trying to break the encryption of the plans (of course they are encrypted – the Empire may be evil, but it is not stupid!). The encryption has several levels of security, and here is how the first one lo...
1,200
false
false
false
false
false
false
true
false
false
false
5,888
117B
In a very ancient country the following game was popular. Two people play the game. Initially first player writes a string _s_1, consisting of exactly nine digits and representing a number that does not exceed _a_. After that second player looks at _s_1 and writes a string _s_2, consisting of exactly nine digits and re...
1,800
false
false
false
false
false
false
true
false
false
false
9,420
600E
Problem - 600E - Codeforces =============== xa0 ]( "21794") β€” the number of vertices in the tree. The second line contains _n_ integers _c__i_ (1u2009≀u2009_c__i_u2009≀u2009_n_), _c__i_ β€” the colour of the _i_-th vertex. Each of the next _n_u2009-u20091 lines contains two integers _x__j_,u2009_y__j_ (1u200...
2,300
false
false
false
false
true
false
false
false
false
false
7,442