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
1954E
There are $$$n$$$ monsters standing in a row. The $$$i$$$-th monster has $$$a_i$$$ health points. Every second, you can choose one alive monster and launch a chain lightning at it. The lightning deals $$$k$$$ damage to it, and also spreads to the left (towards decreasing $$$i$$$) and to the right (towards increasing $$...
2,200
true
true
true
false
true
false
false
true
false
false
550
1878F
Vasilije is a smart student and his discrete mathematics teacher Sonja taught him number theory very well. He gave Ognjen a positive integer $$$n$$$. Denote $$$d(n)$$$ as the number of positive integer divisors of $$$n$$$, and denote $$$gcd(a, b)$$$ as the largest integer $$$g$$$ such that $$$a$$$ is divisible by $$$g$...
1,900
true
false
false
false
false
false
true
false
false
false
1,012
1419A
Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play $$$t$$$ matches of a digit game... In each of $$$t$$$ matches of the digit game, a positive integer is generated. It consists of $$$n$$$ digits. The digits of this intege...
900
false
true
true
false
false
false
false
false
false
false
3,587
879B
Problem - 879B - 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
false
true
false
true
false
false
false
false
false
6,228
1156C
Problem - 1156C - 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,000
false
true
false
false
false
false
false
true
true
false
4,928
584A
Problem - 584A - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,000
true
false
false
false
false
false
false
false
false
false
7,510
1670D
Sehr Sus is an infinite hexagonal grid as pictured below, controlled by MennaFadali, ZerooCool and Hosssam. They love equilateral triangles and want to create $$$n$$$ equilateral triangles on the grid by adding some straight lines. The triangles must all be empty from the inside (in other words, no straight line or hex...
1,700
true
true
true
false
false
false
true
true
false
false
2,254
1371B
# Magical Calendar Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes A competitive eater, Alice is scheduling some practices for an eating contest on a magical calendar. The calendar is unusual because a week contains not necessarily 7 days! In detail, she can c...
1,200
true
false
false
false
false
false
false
false
false
false
3,813
303A
Bike is interested in permutations. A permutation of length _n_ is an integer sequence such that each integer from 0 to (_n_u2009-u20091) appears exactly once in it. For example, [0,u20092,u20091] is a permutation of length 3 while both [0,u20092,u20092] and [1,u20092,u20093] is not. A permutation triple of permutation...
1,300
true
false
true
false
false
true
false
false
false
false
8,623
100C
Problem - 100C - Codeforces =============== xa0 . These numbers will not have any leading zeros. Output Write sum of the two integers. Do not put any leading zeros. Examples Input 2 3 Output 5 Input 1390 2011 Output 3401 Input 12345 54321 Output 66666
1,400
false
false
true
false
false
false
false
false
false
false
9,487
1503D
There is a deck of $$$n$$$ cards. The $$$i$$$-th card has a number $$$a_i$$$ on the front and a number $$$b_i$$$ on the back. Every integer between $$$1$$$ and $$$2n$$$ appears exactly once on the cards. A deck is called sorted if the front values are in increasing order and the back values are in decreasing order. Tha...
2,600
false
true
false
false
true
true
false
false
true
false
3,157
770D
A sequence of square brackets is regular if by inserting symbols "+" and "1" into it, you can get a regular mathematical expression from it. For example, sequences "[[]][]", "[]" and "[[][[]]]" β€” are regular, at the same time "][", "[[]" and "[[]]][" β€” are irregular. Draw the given sequence using a minimalistic pseudog...
1,400
false
false
true
false
false
false
false
false
false
false
6,699
1366E
# Two Arrays Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes You are given two arrays a1, a 2, . . . , a n and b1, b 2, . . . , b m. Array b is sorted in ascending order ( bi < b i+1 for each i from 1 to m βˆ’ 1). You have to divide the array a into m consecut...
2,100
false
false
false
true
false
true
true
true
false
false
3,846
1954A
Alice and Bob have bought a ribbon consisting of $$$n$$$ parts. Now they want to paint it. First, Alice will paint every part of the ribbon into one of $$$m$$$ colors. For each part, she can choose its color arbitrarily. Then, Bob will choose at most $$$k$$$ parts of the ribbon and repaint them into the same color (he ...
900
true
true
false
false
false
true
false
false
false
false
554
1348E
Phoenix is picking berries in his backyard. There are $$$n$$$ shrubs, and each shrub has $$$a_i$$$ red berries and $$$b_i$$$ blue berries. Each basket can contain $$$k$$$ berries. But, Phoenix has decided that each basket may only contain berries from the same shrub or berries of the same color (red or blue). In other ...
2,400
true
true
false
true
false
false
true
false
false
false
3,966
331B1
The Smart Beaver has recently designed and built an innovative nanotechnologic all-purpose beaver mass shaving machine, "Beavershave 5000". Beavershave 5000 can shave beavers by families! How does it work? Very easily! There are _n_ beavers, each of them has a unique id from 1 to _n_. Consider a permutation _a_1,u2009_...
1,700
false
false
true
false
false
false
false
false
false
false
8,520
1118B
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$. She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day. Your task is to find the number of such candi...
1,200
false
false
true
false
false
false
false
false
false
false
5,101
1822D
A permutation is a sequence $$$n$$$ integers, where each integer from $$$1$$$ to $$$n$$$ appears exactly once. For example, $$$[1]$$$, $$$[3,5,2,1,4]$$$, $$$[1,3,2]$$$ are permutations, while $$$[2,3,2]$$$, $$$[4,3,1]$$$, $$$[0]$$$ are not. Given a permutation $$$a$$$, we construct an array $$$b$$$, where $$$b_i = (a_1...
1,200
true
false
false
false
false
true
false
false
false
false
1,348
1214B
There are $$$b$$$ boys and $$$g$$$ girls participating in Olympiad of Metropolises. There will be a board games tournament in the evening and $$$n$$$ participants have accepted the invitation. The organizers do not know how many boys and girls are among them. Organizers are preparing red badges for girls and blue ones ...
1,100
true
false
false
false
false
false
true
false
false
false
4,610
1798F
Grandfather Ahmed's School has $$$n+1$$$ students. The students are divided into $$$k$$$ classes, and $$$s_i$$$ students study in the $$$i$$$-th class. So, $$$s_1 + s_2 + ldots + s_k = n+1$$$. Due to the upcoming April Fools' Day, all students will receive gifts! Grandfather Ahmed planned to order $$$n+1$$$ boxes of gi...
2,500
true
false
false
true
false
false
false
false
false
false
1,485
1093C
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left. There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-ne...
1,300
false
true
false
false
false
false
false
false
false
false
5,242
1280B
You are an all-powerful being and you have created a rectangular world. In fact, your world is so bland that it could be represented by a $$$r imes c$$$ grid. Each cell on the grid represents a country. Each country has a dominant religion. There are only two religions in your world. One of the religions is called Bei...
1,800
true
false
true
false
false
false
false
false
false
false
4,293
1196B
You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, dots, a_n$$$. You want to split it into exactly $$$k$$$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i.u2009e. for each subsegment, the sum of all elements that belong to this subsegment is odd). It is impossible...
1,200
true
false
false
false
false
true
false
false
false
false
4,721
1731F
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 841 (Div. 2) and Divide by Zero 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 ...
2,500
true
false
false
true
false
false
true
false
false
false
1,900
1498D
You have a malfunctioning microwave in which you want to put some bananas. You have $$$n$$$ time-steps before the microwave stops working completely. At each time-step, it displays a new operation. Let $$$k$$$ be the number of bananas in the microwave currently. Initially, $$$k = 0$$$. In the $$$i$$$-th operation, you ...
2,200
false
false
true
true
false
false
false
false
false
true
3,178
1791C
Timur initially had a binary string$$$^{dagger}$$$ $$$s$$$ (possibly of length $$$0$$$). He performed the following operation several (possibly zero) times: Add $$$ exttt{0}$$$ to one end of the string and $$$ exttt{1}$$$ to the other end of the string. For example, starting from the string $$$ exttt{1011}$$$, you can...
800
false
false
true
false
false
false
false
false
false
false
1,533
429B
Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix _a_ with _n_ lines and _m_ columns. Let number _a_[_i_][_j_] represents the calories burned by performing workout at the cell of gym in the _i_-th line and the _j_-th column. Iah...
1,600
false
false
false
true
false
false
false
false
false
false
8,125
1571C
Let's say that two strings $$$s$$$ and $$$t$$$ rhyme if both strings have length at least $$$k$$$, and their last $$$k$$$ characters are equal. For example, if $$$k = 3$$$, the strings abcd and cebcd rhyme, the strings ab and ab don't rhyme, the strings aaaa and aaaaa rhyme, the strings abcd and abce don't rhyme. You h...
1,800
false
false
true
false
false
false
false
false
false
false
2,790
1327G
You are given a string $$$S$$$ and an array of strings $$$[t_1, t_2, dots, t_k]$$$. Each string $$$t_i$$$ consists of lowercase Latin letters from a to n; $$$S$$$ consists of lowercase Latin letters from a to n and no more than $$$14$$$ question marks. Each string $$$t_i$$$ has its cost $$$c_i$$$ β€” an integer number. T...
2,800
false
false
false
true
false
false
false
false
false
false
4,072
902A
Pig is visiting a friend. Pig's house is located at point 0, and his friend's house is located at point _m_ on an axis. Pig can use teleports to move along the axis. To use a teleport, Pig should come to a certain point (where the teleport is located) and choose where to move: for each teleport there is the rightmost p...
1,100
false
true
true
false
false
false
false
false
false
false
6,136
421D
Recently a serious bug has been found in the FOS code. The head of the F company wants to find the culprit and punish him. For that, he set up an organizational meeting, the issue is: who's bugged the code? Each of the _n_ coders on the meeting said: 'I know for sure that either _x_ or _y_ did it!' The head of the comp...
1,900
false
false
false
false
true
false
false
true
true
false
8,144
1821F
There is a beautiful alley with trees in front of a shopping mall. Unfortunately, it has to go to make space for the parking lot. The trees on the alley all grow in a single line. There are $$$n$$$ spots for trees, index $$$0$$$ is the shopping mall, index $$$n+1$$$ is the road and indices from $$$1$$$ to $$$n$$$ are t...
2,600
true
false
false
true
false
false
false
false
false
false
1,352
196B
We've got a rectangular _n_u2009Γ—u2009_m_-cell maze. Each cell is either passable, or is a wall (impassable). A little boy found the maze and cyclically tiled a plane with it so that the plane became an infinite maze. Now on this plane cell (_x_,u2009_y_) is a wall if and only if cell is a wall. In this problem is a re...
2,000
false
false
false
false
false
false
false
false
false
true
9,057
1130A
You are given an array of $$$n$$$ integers: $$$a_1, a_2, ldots, a_n$$$. Your task is to find some non-zero integer $$$d$$$ ($$$-10^3 leq d leq 10^3$$$) such that, after each number in the array is divided by $$$d$$$, the number of positive numbers that are presented in the array is greater than or equal to half of the ...
800
false
false
true
false
false
false
false
false
false
false
5,071
526E
Optimizing the amount of data transmitted via a network is an important and interesting part of developing any network application. In one secret game developed deep in the ZeptoLab company, the game universe consists of _n_ levels, located in a circle. You can get from level _i_ to levels _i_u2009-u20091 and _i_u2009+...
2,400
false
false
true
true
false
false
false
false
false
false
7,727
1744C
You find yourself on an unusual crossroad with a weird traffic light. That traffic light has three possible colors: red (r), yellow (y), green (g). It is known that the traffic light repeats its colors every $$$n$$$ seconds and at the $$$i$$$-th second the color $$$s_i$$$ is on. That way, the order of the colors is des...
1,000
false
false
true
false
false
false
false
true
false
false
1,815
48A
Uncle Fyodor, Matroskin the Cat and Sharic the Dog live their simple but happy lives in Prostokvashino. Sometimes they receive parcels from Uncle Fyodor’s parents and sometimes from anonymous benefactors, in which case it is hard to determine to which one of them the package has been sent. A photographic rifle is obvio...
900
false
false
true
false
false
false
false
false
false
false
9,737
1875C
Jellyfish has $$$n$$$ green apple pieces. Each green apple piece weighs $$$1~ ext{kg}$$$. Jellyfish wants to divide these green apple pieces equally among $$$m$$$ people. Jellyfish has a magic knife. Each time Jellyfish can choose one piece of green apple and divide it into two smaller pieces, with each piece having ha...
1,400
true
true
false
false
false
false
false
false
false
false
1,028
633F
Alice and Bob have a tree (undirected acyclic connected graph). There are _a__i_ chocolates waiting to be picked up in the _i_-th vertex of the tree. First, they choose two different vertices as their starting positions (Alice chooses first) and take all the chocolates contained in them. Then, they alternate their move...
2,600
false
false
false
true
false
false
false
false
false
true
7,270
448A
Problem - 448A - 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,049
280E
Problem - 280E - 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...
3,000
true
false
true
true
true
false
true
false
false
false
8,711
131E
A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines the options given to the rook and the bishop. There are _m_ queens on a square _n_u2009Γ—u2009_n_ che...
1,700
false
false
false
false
false
false
false
false
true
false
9,349
85C
One night, having had a hard day at work, Petya saw a nightmare. There was a binary search tree in the dream. But it was not the actual tree that scared Petya. The horrifying thing was that Petya couldn't search for elements in this tree. Petya tried many times to choose key and look for it in the tree, and each time h...
2,200
false
false
false
false
false
false
false
true
true
false
9,544
340E
Iahub is so happy about inventing bubble sort graphs that he's staying all day long at the office and writing permutations. Iahubina is angry that she is no more important for Iahub. When Iahub goes away, Iahubina comes to his office and sabotage his research work. The girl finds an important permutation for the resear...
2,000
true
false
false
false
false
false
false
false
false
false
8,471
1978D
Elections are taking place in Berland. There are $$$n$$$ candidates participating in the elections, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candidate has $$$a_i$$$ fans who will vote for him. Additionally, there are $$$c$$$ people who are undecided about their favorite candidate, let's call them undecided. Und...
1,600
true
true
true
false
true
false
false
false
false
false
419
1682B
You are given a permutation $$$p$$$ of integers from $$$0$$$ to $$$n-1$$$ (each of them occurs exactly once). Initially, the permutation is not sorted (that is, $$$p_i>p_{i+1}$$$ for at least one $$$1 le i le n - 1$$$). The permutation is called $$$X$$$-sortable for some non-negative integer $$$X$$$ if it is possible t...
1,100
false
false
false
false
false
true
false
false
true
false
2,178
50D
The commanding officers decided to drop a nuclear bomb on the enemy's forces. You are ordered to determine the power of the warhead that needs to be used. The enemy has _N_ strategically important objects. Their positions are known due to the intelligence service. The aim of the strike is to deactivate at least _K_ imp...
2,100
false
false
false
true
false
false
false
true
false
false
9,721
1699E
Ibti was thinking about a good title for this problem that would fit the round theme (numerus ternarium). He immediately thought about the third derivative, but that was pretty lame so he decided to include the best band in the world β€” - min(a_i)$$$. Find the minimum possible balance after performing any number (possib...
2,600
true
true
false
true
true
false
false
false
false
false
2,083
2018B
There are $$$n$$$ cities in a row, numbered $$$1, 2, ldots, n$$$ left to right. At time $$$1$$$, you conquer exactly one city, called the starting city. At time $$$2, 3, ldots, n$$$, you can choose a city adjacent to the ones conquered so far and conquer it. You win if, for each $$$i$$$, you conquer city $$$i$$$ at a...
1,900
false
true
true
true
true
false
false
true
false
false
162
847L
In the computer network of the Berland State University there are _n_ routers numbered from 1 to _n_. Some pairs of routers are connected by patch cords. Information can be transmitted over patch cords in both direction. The network is arranged in such a way that communication between any two routers (directly or throu...
2,400
false
false
false
false
false
true
false
false
false
true
6,360
551C
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way. In total there are _n_ piles of boxes, arranged in a line, from left to right, _i_-th pile (1u2009≀u2009_i_u2009≀u2009_n_) containing _a__i_ boxes. Luckily, _m_ students are willing to help GukiZ by removin...
2,200
false
true
false
false
false
false
false
true
false
false
7,630
1307E
After a successful year of milk production, Farmer John is rewarding his cows with their favorite treat: tasty grass! On the field, there is a row of $$$n$$$ units of grass, each with a sweetness $$$s_i$$$. Farmer John has $$$m$$$ cows, each with a favorite sweetness $$$f_i$$$ and a hunger value $$$h_i$$$. He would lik...
2,500
true
true
true
true
false
false
false
true
false
false
4,152
946D
Ivan is a student at Berland State University (BSU). There are _n_ days in Berland week, and each of these days Ivan might have some classes at the university. There are _m_ working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during _i_-...
1,800
false
false
false
true
false
false
false
false
false
false
5,929
1886E
Monocarp is a team leader in a massive IT company. There are $$$m$$$ projects his team of programmers has to complete, numbered from $$$1$$$ to $$$m$$$. The $$$i$$$-th project has a difficulty level $$$b_i$$$. There are $$$n$$$ programmers in the team, numbered from $$$1$$$ to $$$n$$$. The $$$j$$$-th programmer has a s...
2,400
true
true
false
true
false
true
false
false
true
false
973
1985G
Problem - 1985G - 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
false
false
false
false
false
false
false
false
368
982D
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations. Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All th...
1,900
false
false
false
false
true
false
true
false
false
false
5,789
793D
Bankopolis is an incredible city in which all the _n_ crossroads are located on a straight line and numbered from 1 to _n_ along it. On each crossroad there is a bank office. The crossroads are connected with _m_ oriented bicycle lanes (the _i_-th lane goes from crossroad _u__i_ to crossroad _v__i_), the difficulty of ...
2,100
false
false
false
true
false
false
false
false
false
true
6,604
755G
Problem - 755G - Codeforces =============== xa0 , denoting the number of Balls and the maximim number of groups, respectively. Output You should output a sequence of _k_ values. The _i_-th of them should represent the sought number of divisions into exactly _i_ groups, according to PolandBall's rules. Exa...
3,200
true
false
false
true
false
false
false
false
false
false
6,771
1165C
Problem - 1165C - 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,300
false
true
false
false
false
false
false
false
false
false
4,894
1252B
The new ICPC town has $$$N$$$ junctions (numbered from $$$1$$$ to $$$N$$$) which are connected by $$$N-1$$$ roads. It is possible from one junction to go to any other junctions by going through one or more roads. To make sure all the junctions are well-maintained, the government environment agency is planning to deploy...
2,300
false
false
false
true
false
false
false
false
false
false
4,433
1914D
Winter holidays are coming up. They are going to last for $$$n$$$ days. During the holidays, Monocarp wants to try all of these activities exactly once with his friends: go skiing; watch a movie in a cinema; play board games. Monocarp knows that, on the $$$i$$$-th day, exactly $$$a_i$$$ friends will join him for ski...
1,200
false
true
true
true
false
false
true
false
true
false
816
850C
Problem - 850C - 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
false
false
false
true
false
false
false
false
false
false
6,349
1499F
You are given an integer $$$k$$$ and an undirected tree, consisting of $$$n$$$ vertices. The length of a simple path (a path in which each vertex appears at most once) between some pair of vertices is the number of edges in this path. A diameter of a tree is the maximum length of a simple path between all pairs of vert...
2,400
false
false
false
true
false
false
false
false
false
false
3,170
1854A2
The only difference between the two versions of this problem is the constraint on the maximum number of operations. You can make hacks only if all versions of the problem are solved. You are given an array $$$a_1, a_2,dots, a_n$$$ of integers (positive, negative or $$$0$$$). You can perform multiple operations on the a...
1,900
true
false
false
false
false
true
false
false
false
false
1,158
1511E
You have a large rectangular board which is divided into $$$n imes m$$$ cells (the board has $$$n$$$ rows and $$$m$$$ columns). Each cell is either white or black. You paint each white cell either red or blue. Obviously, the number of different ways to paint them is $$$2^w$$$, where $$$w$$$ is the number of white cell...
2,100
true
true
false
true
false
false
false
false
false
false
3,112
1991C
You are given an array $$$a$$$ of $$$n$$$ integers. In one operation, you will perform the following two-step move: 1. Choose an integer $$$x$$$ ($$$0 le x le 10^{9}$$$). 2. Replace each $$$a_i$$$ with $$$a_i - x$$$, where $$$v$$$ denotes the xa0β€” the number of test cases. The description of test cases follows. The fir...
1,300
true
true
false
false
false
true
false
false
false
false
326
1142B
Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $$$p$$$ of length $$$n$$$, and Skynyrd bought an array $$$a$$$ of length $$$m$$$, consisting of integers from $$$1$$$ to $$$n$$$. Lynyrd and Skynyrd became bored, so they asked you $$$q$$$ queries, each of which has the following form: "does t...
2,000
true
false
false
true
true
false
false
false
false
false
5,012
1928C
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...
1,600
true
false
false
false
false
false
true
false
false
false
721
538E
Demiurges Shambambukli and Mazukta love to watch the games of ordinary people. Today, they noticed two men who play the following game. There is a rooted tree on _n_ nodes, _m_ of which are leaves (a leaf is a nodes that does not have any children), edges of the tree are directed from parent to children. In the leaves ...
2,200
true
false
false
true
false
false
false
false
false
false
7,684
1697F
You are asked to build an array $$$a$$$, consisting of $$$n$$$ integers, each element should be from $$$1$$$ to $$$k$$$. The array should be non-decreasing ($$$a_i le a_{i+1}$$$ for all $$$i$$$ from $$$1$$$ to $$$n-1$$$). You are also given additional constraints on it. Each constraint is of one of three following type...
2,800
false
false
true
false
false
true
false
false
false
true
2,095
1359C
There are two infinite sources of water: hot water of temperature $$$h$$$; cold water of temperature $$$c$$$ ($$$c < h$$$). You perform the following procedure of alternating moves: 1. take one cup of the hot water and pour it into an infinitely deep barrel; 2. take one cup of the cold water and pour it into an infin...
1,700
true
false
false
false
false
false
false
true
false
false
3,889
1991H
Alice and Bob are playing a game with $$$n$$$ piles of stones, where the $$$i$$$-th pile has $$$a_i$$$ stones. Players take turns making moves, with Alice going first. On each move, the player does the following three-step process: 1. Choose an integer $$$k$$$ ($$$1 leq k leq frac n 2$$$). Note that the value of $$$k$$...
3,300
true
false
false
true
false
false
false
false
false
false
321
1626E
You are given a tree consisting of $$$n$$$ vertices. Some of the vertices (at least two) are black, all the other vertices are white. You place a chip on one of the vertices of the tree, and then perform the following operations: let the current vertex where the chip is located is $$$x$$$. You choose a black vertex $$...
2,400
false
true
false
false
false
false
false
false
false
false
2,483
1105C
Problem - 1105C - 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
true
false
false
true
false
false
false
false
false
false
5,178
1623B
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 763 (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...
1,100
false
false
true
false
false
false
true
false
true
false
2,504
1351B
Vasya claims that he had a paper square. He cut it into two rectangular parts using one vertical or horizontal cut. Then Vasya informed you the dimensions of these two rectangular parts. You need to check whether Vasya originally had a square. In other words, check if it is possible to make a square using two given rec...
900
true
false
true
false
false
false
true
false
false
false
3,954
1329A
Dreamoon likes coloring cells very much. There is a row of $$$n$$$ cells. Initially, all cells are empty (don't contain any color). Cells are numbered from $$$1$$$ to $$$n$$$. You are given an integer $$$m$$$ and $$$m$$$ integers $$$l_1, l_2, ldots, l_m$$$ ($$$1 le l_i le n$$$) Dreamoon will perform $$$m$$$ operations....
1,800
true
true
true
false
false
true
false
false
false
false
4,065
1707C
You are given a connected undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. The weight of the $$$i$$$-th edge is $$$i$$$. Here is a wrong algorithm of finding a of a graph: vis := an array of length n s := a set of edgesfunction dfs(u): vis[u] := true iterate through each edge (u, v) in the orde...
2,400
false
true
false
false
false
false
false
false
true
true
2,032
142B
Once upon a time in the Kingdom of Far Far Away lived Sir Lancelot, the chief Royal General. He was very proud of his men and he liked to invite the King to come and watch drill exercises which demonstrated the fighting techniques and tactics of the squad he was in charge of. But time went by and one day Sir Lancelot h...
1,800
false
true
true
false
false
true
false
false
false
false
9,306
1406A
Given a set of integers (it can contain equal elements). You have to split it into two subsets $$$A$$$ and $$$B$$$ (both of them can contain equal elements or be empty). You have to maximize the value of $$$mex(A)+mex(B)$$$. Here $$$mex$$$ of a set denotes the smallest non-negative integer that doesn't exist in the set...
900
true
true
true
false
false
false
false
false
false
false
3,646
1914G2
The easy and hard versions of this problem differ only in the constraints on $$$n$$$. In the hard version, the sum of values of $$$n$$$ over all test cases does not exceed $$$2 cdot 10^5$$$. Furthermore, there are no additional constraints on the value of $$$n$$$ in a single test case. There are $$$2n$$$ light bulbs ar...
2,300
false
false
false
true
true
false
false
false
false
true
811
1364B
Given a permutation $$$p$$$ of length $$$n$$$, find its subsequence $$$s_1$$$, $$$s_2$$$, $$$ldots$$$, $$$s_k$$$ of length at least $$$2$$$ such that: $$$s_1-s_2+s_2-s_3+ldots+s_{k-1}-s_k$$$ is as big as possible over all subsequences of $$$p$$$ with length at least $$$2$$$. Among all such subsequences, choose the on...
1,300
false
true
false
false
false
false
false
false
false
false
3,861
483B
You have two friends. You want to present each of them several positive integers. You want to present _cnt_1 numbers to the first friend and _cnt_2 numbers to the second friend. Moreover, you want all presented numbers to be distinct, that also means that no number should be presented to both friends. In addition, the ...
1,800
true
false
false
false
false
false
false
true
false
false
7,903
1822G1
This is the easy version of the problem. The only difference is that in this version, $$$a_i le 10^6$$$. For a given sequence of $$$n$$$ integers $$$a$$$, a triple $$$(i, j, k)$$$ is called magic if: $$$1 le i, j, k le n$$$. $$$i$$$, $$$j$$$, $$$k$$$ are pairwise distinct. there exists a positive integer $$$b$$$ suc...
1,700
true
false
false
false
true
false
true
false
false
false
1,345
471E
Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev decided to do some painting. As they were trying to create their first masterpiece, they made a draft on a piece of paper. The draft consists of _n_ segments. Each segment was either horizontal or vertical. Now the ...
2,700
false
false
false
false
true
false
false
false
false
false
7,948
383E
Iahubina is tired of so many complicated languages, so she decided to invent a new, simple language. She already made a dictionary consisting of _n_ 3-words. A 3-word is a sequence of exactly 3 lowercase letters of the first 24 letters of the English alphabet (_a_ to _x_). She decided that some of the letters are vowel...
2,700
false
false
false
true
false
false
false
false
false
false
8,294
1503F
A balanced bracket sequence is defined as an integer sequence that can be built with the following rules: The empty sequence is balanced. If $$$[a_1,ldots,a_n]$$$ and $$$[b_1,ldots, b_m]$$$ are balanced, then their concatenation $$$[a_1,ldots,a_n,b_1,ldots,b_m]$$$ is balanced. If $$$x$$$ is a positive integer and $$...
3,500
false
false
true
false
true
true
false
false
false
true
3,155
1370E
Naman has two binary strings $$$s$$$ and $$$t$$$ of length $$$n$$$ (a binary string is a string which only consists of the characters "0" and "1"). He wants to convert $$$s$$$ into $$$t$$$ using the following operation as few times as possible. In one operation, he can choose any subsequence of $$$s$$$ and rotate it cl...
2,100
false
true
false
false
true
true
false
true
false
false
3,817
1672E
This is an interactive problem. There are $$$n$$$ words in a text editor. The $$$i$$$-th word has length $$$l_i$$$ ($$$1 leq l_i leq 2000$$$). The array $$$l$$$ is hidden and only known by the grader. The text editor displays words in lines, splitting each two words in a line with at least one space. Note that a line d...
2,200
false
true
false
false
false
true
false
true
false
false
2,241
501E
Problem - 501E - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,500
false
false
true
false
false
false
false
true
false
false
7,826
509E
Problem - 509E - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,000
true
false
false
false
false
false
false
false
false
false
7,802
519D
A and B are preparing themselves for programming contests. After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also developed rather peculiar tastes. A likes lowercase letters of the Latin alphabet. He has assigned to each letter a nu...
1,800
false
false
false
true
true
false
false
false
false
false
7,759
1042E
Vasya has got a magic matrix $$$a$$$ of size $$$n imes m$$$. The rows of the matrix are numbered from $$$1$$$ to $$$n$$$ from top to bottom, the columns are numbered from $$$1$$$ to $$$m$$$ from left to right. Let $$$a_{ij}$$$ be the element in the intersection of the $$$i$$$-th row and the $$$j$$$-th column. Vasya ha...
2,300
true
false
false
true
false
false
false
false
false
false
5,485
1256B
You are given a permutation of length $$$n$$$. Recall that the permutation is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2, 3, 1, 5, 4]$$$ is a permutation, but $$$[1, 2, 2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1, 3, 4]$$...
1,400
false
true
false
false
false
false
false
false
false
false
4,406
1066F
Maksim walks on a Cartesian plane. Initially, he stands at the point $$$(0, 0)$$$ and in one move he can go to any of four adjacent points (left, right, up, down). For example, if Maksim is currently at the point $$$(0, 0)$$$, he can go to any of the following points in one move: $$$(1, 0)$$$; $$$(0, 1)$$$; $$$(-1, ...
2,100
false
false
false
true
false
false
false
false
false
false
5,376
1083A
The Fair Nut is going to travel to the Tree Country, in which there are $$$n$$$ cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connected graph without cycles). Nut wants to rent a car in the city $$$u$$$ and go by a simple path to city $$$v$$$. He hasn't ...
1,800
false
false
false
true
true
false
false
false
false
false
5,308
1956B
You and Nene are playing a card game. The deck with $$$2n$$$ cards is used to play this game. Each card has an integer from $$$1$$$ to $$$n$$$ on it, and each of integers $$$1$$$ through $$$n$$$ appears exactly on $$$2$$$ cards. Additionally, there is a table where cards are placed during the game (initially, the table...
800
false
true
false
false
false
false
false
false
false
false
539
1889B
Doremy lives in a country consisting of $$$n$$$ cities numbered from $$$1$$$ to $$$n$$$, with $$$a_i$$$ people living in the $$$i$$$-th city. It can be modeled as an undirected graph with $$$n$$$ nodes. Initially, there are no edges in the graph. Now Doremy wants to make the graph connected. To do this, she can add an ...
1,700
true
true
false
false
false
true
false
false
true
false
965
1977C
Nikita is a student passionate about number theory and algorithms. He faces an interesting problem related to an array of numbers. Suppose Nikita has an array of integers $$$a$$$ of length $$$n$$$. He will call a subsequence$$$^dagger$$$ of the array special if its elements, without changing the order of the remaining ...
1,900
true
true
false
true
true
false
true
false
true
false
425
433C
Ryouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what she hears on the notebook, and the notebook became her memory. Though Ryouko is forgetful, she is also bor...
1,800
true
false
true
false
false
false
false
false
true
false
8,107