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
1016D
Now Vasya is taking an exam in mathematics. In order to get a good mark, Vasya needs to guess the matrix that the teacher has constructed! Vasya knows that the matrix consists of _n_ rows and _m_ columns. For each row, he knows the xor (bitwise excluding or) of the elements in this row. The sequence _a_1,u2009_a_2,u200...
1,800
true
false
false
false
false
true
false
false
false
false
5,609
1902C
You are given an integer array $$$a_1, a_2, dots, a_n$$$, all its elements are distinct. First, you are asked to insert one more integer $$$a_{n+1}$$$ into this array. $$$a_{n+1}$$$ should not be equal to any of $$$a_1, a_2, dots, a_n$$$. Then, you will have to make all elements of the array equal. At the start, you ch...
1,300
true
true
false
false
false
true
true
false
false
false
901
185B
As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (_x_,u2009_y_,u2009_z_). In this coordinate system, the distance between the center of the Universe and the point is calculated by the following...
1,800
true
false
false
false
false
false
false
false
false
false
9,103
1111B
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations. Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, ldots, a_n$$$, respectively. In one operat...
1,700
true
false
true
false
false
false
true
false
false
false
5,140
54C
In the probability theory the following paradox called Benford's law is known: "In many lists of random numbers taken from real sources, numbers starting with digit 1 occur much more often than numbers starting with any other digit" (that's the simplest form of the law). Having read about it on Codeforces, the Hedgehog...
2,000
true
false
false
true
false
false
false
false
false
false
9,703
1932A
During your journey through computer universes, you stumbled upon a very interesting world. It is a path with $$$n$$$ consecutive cells, each of which can either be empty, contain thorns, or a coin. In one move, you can move one or two cells along the path, provided that the destination cell does not contain thorns (an...
800
false
true
true
true
false
false
false
false
false
false
694
1181E2
This problem differs from the previous problem only in constraints. Petya decided to visit Byteland during the summer holidays. It turned out that the history of this country is quite unusual. Initially, there were $$$n$$$ different countries on the land that is now Berland. Each country had its own territory that was ...
3,000
false
true
false
false
false
false
true
false
true
false
4,809
610E
You are given a string _s_ of length _n_, consisting of first _k_ lowercase English letters. We define a _c_-repeat of some string _q_ as a string, consisting of _c_ copies of the string _q_. For example, string "acbacbacbacb" is a 4-repeat of the string "acb". Let's say that string _a_ contains string _b_ as a subsequ...
2,500
false
false
false
false
true
false
false
false
false
false
7,402
271A
Problem - 271A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
800
false
false
false
false
false
false
true
false
false
false
8,751
533A
The biggest gold mine in Berland consists of _n_ caves, connected by _n_u2009-u20091 transitions. The entrance to the mine leads to the cave number 1, it is possible to go from it to any remaining cave of the mine by moving along the transitions. The mine is being developed by the InMine Inc., _k_ miners work for it. E...
3,000
false
true
false
false
true
false
false
true
false
false
7,707
566D
Even the most successful company can go through a crisis period when you have to make a hard decision — to restructure, discard and merge departments, fire employees and do other unpleasant stuff. Let's consider the following model of a company. There are _n_ people working for the Large Software Company. Each person b...
1,900
false
false
false
false
true
false
false
false
false
false
7,588
1250G
Eulampius has created a game with the following rules: there are two players in the game: a human and a computer; the game lasts for no more than $$$n$$$ rounds. Initially both players have $$$0$$$ points. In the $$$j$$$-th round the human gains $$$a_j$$$ points, and the computer gains $$$b_j$$$ points. The points ar...
2,300
false
true
false
true
false
false
false
false
false
false
4,449
546E
In the country there are _n_ cities and _m_ bidirectional roads between them. Each city has an army. Army of the _i_-th city consists of _a__i_ soldiers. Now soldiers roam. After roaming each soldier has to either stay in his city or to go to the one of neighboring cities by at moving along at most one road. Check if i...
2,100
true
false
false
false
false
false
false
false
false
true
7,653
1893E
You are given an undirected connected graph in which any two distinct simple cycles do not have common vertices. Since the graph can be very large, it is given to you in a compressed form: for each edge, you are also given a number $$$d$$$, which indicates that there are $$$d$$$ additional vertices on this edge. You ne...
3,500
false
false
false
true
false
false
false
false
false
true
947
1090H
, # Problem A. Linearization Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 512 megabytes Bitwise “and” of two non-negative integers is calculated as follows: write both numbers in binary, then the i-th binary digit of the result is equal to 1 if both arguments have the ...
2,900
false
false
false
false
false
false
false
false
false
true
5,265
985C
You have _m_u2009=u2009_n_·_k_ wooden staves. The _i_-th stave has length _a__i_. You have to assemble _n_ barrels consisting of _k_ staves each, you can use any _k_ staves to construct a barrel. Each stave must belong to exactly one barrel. Let volume _v__j_ of barrel _j_ be equal to the length of the minimal stave in...
1,500
false
true
false
false
false
false
false
false
false
false
5,777
1006A
Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!). Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps: Replace each ...
800
false
false
true
false
false
false
false
false
false
false
5,655
2041H
Image generated by ChatGPT 4o. Alice likes singing. As a singing enthusiast, Alice has listened to countless songs and has tried singing them many times. However, occasionally, some songs make Alice feel bored. After some research, Alice believes that this is because even though the songs she chose are all different, d...
2,300
true
false
false
true
false
false
false
false
false
false
6
1486B
You and your friends live in $$$n$$$ houses. Each house is located on a 2D plane, in a point with integer coordinates. There might be different houses located in the same point. The mayor of the city is asking you for places for the building of the Eastern exhibition. You have to find the number of places (points with ...
1,500
false
false
false
false
false
false
false
true
true
false
3,252
887E
Masha's little brother draw two points on a sheet of paper. After that, he draws some circles and gave the sheet to his sister. Masha has just returned from geometry lesson so she instantly noticed some interesting facts about brother's drawing. At first, the line going through two points, that brother drew, doesn't in...
2,800
false
false
false
false
false
false
false
true
true
false
6,198
1471B
You have given an array $$$a$$$ of length $$$n$$$ and an integer $$$x$$$ to a brand new robot. What the robot does is the following: it iterates over the elements of the array, let the current element be $$$q$$$. If $$$q$$$ is divisible by $$$x$$$, the robot adds $$$x$$$ copies of the integer $$$frac{q}{x}$$$ to the en...
1,100
true
true
true
false
false
false
true
false
false
false
3,325
1602B
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 751 (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
true
false
false
false
false
2,644
1316F
There are $$$n$$$ officers in the Army of Byteland. Each officer has some power associated with him. The power of the $$$i$$$-th officer is denoted by $$$p_{i}$$$. As the war is fast approaching, the General would like to know the strength of the army. The strength of an army is calculated in a strange way in Byteland....
2,800
false
false
false
false
true
false
false
false
false
false
4,116
1107E
Vasya has a string $$$s$$$ of length $$$n$$$ consisting only of digits 0 and 1. Also he has an array $$$a$$$ of length $$$n$$$. Vasya performs the following operation until the string becomes empty: choose some consecutive substring of equal characters, erase it from the string and glue together the remaining parts (an...
2,400
false
false
false
true
false
false
false
false
false
false
5,165
408A
Little Vasya went to the supermarket to get some groceries. He walked about the supermarket for a long time and got a basket full of products. Now he needs to choose the cashier to pay for the products. There are _n_ cashiers at the exit from the supermarket. At the moment the queue for the _i_-th cashier already has _...
900
false
false
true
false
false
false
false
false
false
false
8,193
704B
Scott Lang is at war with Darren Cross. There are _n_ chairs in a hall where they are, numbered with 1,u20092,u2009...,u2009_n_ from left to right. The _i_-th chair is located at coordinate _x__i_. Scott is on chair number _s_ and Cross is on chair number _e_. Scott can jump to all other chairs (not only neighboring ch...
2,500
false
true
false
true
false
false
false
false
false
true
7,005
742A
Problem - 742A - 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
true
false
false
false
false
false
false
false
6,831
1843F2
This is the hard version of the problem. The only difference between the simple and hard versions is that in this version $$$u$$$ can take any possible value. As is known, Omsk is the capital of Berland. Like any capital, Omsk has a well-developed metro system. The Omsk metro consists of a certain number of stations co...
2,300
true
false
false
true
true
false
false
false
false
false
1,224
1945D
The guys lined up in a queue of $$$n$$$ people, starting with person number $$$i = 1$$$, to ask Serafim the Owl about the meaning of life. Unfortunately, Kirill was very busy writing the legend for this problem, so he arrived a little later and stood at the end of the line after the $$$n$$$-th person. Kirill is complet...
1,300
false
true
false
true
false
false
false
false
false
false
610
1336B
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. xa0Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight. Now, she is going to pick three gems. Xenia loves colorful...
1,700
true
true
false
false
false
false
false
true
true
false
4,022
1249F
You are given a tree, which consists of $$$n$$$ vertices. Recall that a tree is a connected undirected graph without cycles. Example of a tree. Vertices are numbered from $$$1$$$ to $$$n$$$. All vertices have weights, the weight of the vertex $$$v$$$ is $$$a_v$$$. Recall that the distance between two vertices in the t...
2,200
false
false
false
true
false
false
false
false
false
false
4,456
1898E
Sofia has a string $$$s$$$ of length $$$n$$$, consisting only of lowercase English letters. She can perform operations of the following types with this string. 1. Select an index $$$1 le i le s$$$ and remove the character $$$s_i$$$ from the string. 2. Select a pair of indices $$$(l, r)$$$ ($$$1 le l le r le s$$$) and s...
2,200
false
true
false
false
true
false
false
false
true
false
924
832A
It's one more school day now. Sasha doesn't like classes and is always bored at them. So, each day he invents some game and plays in it alone or with friends. Today he invented one simple game to play with Lena, with whom he shares a desk. The rules are simple. Sasha draws _n_ sticks in a row. After that the players ta...
800
true
false
false
false
false
false
false
false
false
false
6,439
652F
_n_ ants are on a circle of length _m_. An ant travels one unit of distance per one unit of time. Initially, the ant number _i_ is located at the position _s__i_ and is facing in the direction _d__i_ (which is either L or R). Positions are numbered in counterclockwise order starting from some point. Positions of the al...
2,800
true
false
false
false
false
true
false
false
false
false
7,205
809D
Leha and Noora decided to go on a trip in the Baltic States. As you know from the previous problem, Leha has lost his car on the parking of the restaurant. Unfortunately, requests to the watchman didn't helped hacker find the car, so friends decided to go hitchhiking. In total, they intended to visit _n_ towns. However...
2,900
false
false
false
true
true
false
false
false
false
false
6,525
1175F
Problem - 1175F - 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,500
true
false
false
false
true
false
true
false
false
false
4,840
224A
Problem - 224A - 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
false
false
false
false
true
false
false
false
8,942
641C
Little Artem is fond of dancing. Most of all dances Artem likes ruedaxa0— Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together. More detailed, there are _n_ pairs of boys and girls standing in a circle. Initially, boy number 1 dances with a girl number 1, boy number 2 dances with ...
1,800
false
false
true
false
false
true
true
false
false
false
7,249
1621E
You have decided to open a new school. You have already found $$$n$$$ teachers and $$$m$$$ groups of students. The $$$i$$$-th group of students consists of $$$k_i geq 2$$$ students. You know age of each teacher and each student. The ages of teachers are $$$a_1, a_2, ldots, a_n$$$ and the ages of students of the $$$i$$$...
2,300
false
true
true
true
true
false
false
true
true
false
2,516
1107B
Problem - 1107B - 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,000
true
false
false
false
false
false
false
false
false
false
5,168
269C
Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet — it calculates the maximum flow in an undirected graph. The graph consists of _n_ vertices and _m_ edges. Vertices are numbered from 1 to _n_. Vertices 1 and _n_ being the source and the sink respectively. Howev...
2,100
false
true
false
false
false
true
false
false
false
true
8,756
1505E
Problem - 1505E - Codeforces =============== xa0 , she will only go east (right) or south (down), until she reaches the southeast corner (the bottom right cell). She will eat every berry in the squares she passes through, but not in the other squares. The mouse tries to choose her path so as to maximize t...
1,800
false
true
true
false
false
false
false
false
false
false
3,148
903E
We had a string _s_ consisting of _n_ lowercase Latin letters. We made _k_ copies of this string, thus obtaining _k_ identical strings _s_1,u2009_s_2,u2009...,u2009_s__k_. After that, in each of these strings we swapped exactly two characters (the characters we swapped could be identical, but they had different indices...
2,200
false
false
true
false
false
false
true
false
false
false
6,130
559C
Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an _h_u2009×u2009_w_ field, and it is painted in two colors, but not like in chess. Almost all cells of the field are white and only some of them are black. Currently Gerald is finishing a...
2,200
true
false
false
true
false
false
false
false
false
false
7,596
76B
Modern researches has shown that a flock of hungry mice searching for a piece of cheese acts as follows: if there are several pieces of cheese then each mouse chooses the closest one. After that all mice start moving towards the chosen piece of cheese. When a mouse or several mice achieve the destination point and ther...
2,100
false
true
false
false
false
false
false
false
false
false
9,585
1725A
Pak Chanek has a grid that has $$$N$$$ rows and $$$M$$$ columns. Each row is numbered from $$$1$$$ to $$$N$$$ from top to bottom. Each column is numbered from $$$1$$$ to $$$M$$$ from left to right. Each tile in the grid contains a number. The numbers are arranged as follows: Row $$$1$$$ contains integers from $$$1$$$ ...
800
true
false
false
false
false
false
false
false
false
false
1,946
813D
Alice is a beginner composer and now she is ready to create another masterpiece. And not even the single one but two at the same time! Alice has a sheet with _n_ notes written on it. She wants to take two such non-empty non-intersecting subsequences that both of them form a melody and sum of their lengths is maximal. S...
2,600
false
false
false
true
false
false
false
false
false
false
6,508
1951B
There are $$$n$$$ cows participating in a coding tournament. Cow $$$i$$$ has a Cowdeforces rating of $$$a_i$$$ (all distinct), and is initially in position $$$i$$$. The tournament consists of $$$n-1$$$ matches as follows: The first match is between the cow in position $$$1$$$ and the cow in position $$$2$$$. Subseque...
1,200
false
true
false
false
true
false
false
true
false
false
573
1535B
Problem - 1535B - 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 - ...
900
true
true
false
false
false
false
true
false
true
false
2,973
856F
Vasya and Petya are playing an online game. As most online games, it has hero progress system that allows players to gain experience that make their heroes stronger. Of course, Vasya would like to get as many experience points as possible. After careful study of experience points allocation, he found out that if he pla...
3,000
false
true
false
false
false
false
false
false
false
false
6,315
911D
Problem - 911D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,800
true
false
false
false
false
false
true
false
false
false
6,100
494C
Malek is a rich man. He also is very generous. That's why he decided to split his money between poor people. A charity institute knows _n_ poor people numbered from 1 to _n_. The institute gave Malek _q_ recommendations. A recommendation is a segment of people like [_l_,u2009_r_] which means the institute recommended t...
2,600
false
false
false
true
false
false
false
false
false
false
7,856
457F
Pieguy and Piegirl are playing a game. They have a rooted binary tree, that has a property that each node is either a leaf or has exactly two children. Each leaf has a number associated with it. On his/her turn a player can choose any two leafs that share their immediate parent, remove them, and associate either of the...
3,200
false
true
false
true
false
false
false
false
false
false
8,007
385A
The bear decided to store some raspberry for the winter. He cunningly found out the price for a barrel of honey in kilos of raspberry for each of the following _n_ days. According to the bear's data, on the _i_-th (1u2009≤u2009_i_u2009≤u2009_n_) day, the price for one barrel of honey is going to is _x__i_ kilos of rasp...
1,000
false
true
true
false
false
false
true
false
false
false
8,291
243C
Old MacDonald has a farm and a large potato field, (1010u2009+u20091)u2009×u2009(1010u2009+u20091) square meters in size. The field is divided into square garden beds, each bed takes up one square meter. Old McDonald knows that the Colorado potato beetle is about to invade his farm and can destroy the entire harvest. T...
2,200
false
false
true
false
false
false
false
false
false
false
8,861
1909F1
In the easy version, the $$$a_i$$$ are in the range $$$[0, n]$$$; in the hard version, the $$$a_i$$$ are in the range $$$[-1, n]$$$ and the definition of good permutation is slightly different. You can make hacks only if all versions of the problem are solved. You are given an integer $$$n$$$ and an array $$$a_1, a_2 d...
2,200
true
false
false
true
false
false
true
false
false
false
852
1796C
A set of positive integers $$$S$$$ is called beautiful if, for every two integers $$$x$$$ and $$$y$$$ from this set, either $$$x$$$ divides $$$y$$$ or $$$y$$$ divides $$$x$$$ (or both). You are given two integers $$$l$$$ and $$$r$$$. Consider all beautiful sets consisting of integers not less than $$$l$$$ and not great...
1,600
true
false
false
false
false
false
false
true
false
false
1,500
2018E2
This is the hard version of the problem. In this version, the constraints on $$$n$$$ and the time limit are higher. You can make hacks only if both versions of the problem are solved. A set of (closed) segments is complex if it can be partitioned into some subsets such that all the subsets have the same size; and a p...
3,400
true
true
false
false
true
false
false
true
true
false
158
319E
Problem - 319E - 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
false
false
false
false
true
false
false
false
false
false
8,554
1492E
You are storing an integer array of length $$$m$$$ in a database. To maintain internal integrity and protect data, the database stores $$$n$$$ copies of this array. Unfortunately, the recent incident may have altered the stored information in every copy in the database. It's believed, that the incident altered at most ...
2,500
false
true
true
false
false
true
true
false
false
false
3,209
1749D
Consider an array $$$a$$$ of length $$$n$$$ with elements numbered from $$$1$$$ to $$$n$$$. It is possible to remove the $$$i$$$-th element of $$$a$$$ if $$$gcd(a_i, i) = 1$$$, where $$$gcd$$$ denotes the greatest common divisor. After an element is removed, the elements to the right are shifted to the left by one posi...
1,900
true
false
false
true
false
false
false
false
false
false
1,788
1279C
Santa has to send presents to the kids. He has a large stack of $$$n$$$ presents, numbered from $$$1$$$ to $$$n$$$; the topmost present has number $$$a_1$$$, the next present is $$$a_2$$$, and so on; the bottom present has number $$$a_n$$$. All numbers are distinct. Santa has a list of $$$m$$$ distinct presents he has ...
1,400
false
false
true
false
true
false
false
false
false
false
4,298
427D
Police headquarter is monitoring signal on different frequency levels. They have got two suspiciously encoded strings _s_1 and _s_2 from two different frequencies as signals. They are suspecting that these two strings are from two different criminals and they are planning to do some evil task. Now they are trying to fi...
2,200
false
false
false
true
false
false
false
false
false
false
8,128
1313E
Vasya had three strings $$$a$$$, $$$b$$$ and $$$s$$$, which consist of lowercase English letters. The lengths of strings $$$a$$$ and $$$b$$$ are equal to $$$n$$$, the length of the string $$$s$$$ is equal to $$$m$$$. Vasya decided to choose a substring of the string $$$a$$$, then choose a substring of the string $$$b$$...
2,700
false
false
false
false
true
false
false
false
false
false
4,125
1549A
Gregor is learning about RSA cryptography, and although he doesn't understand how RSA works, he is now fascinated with prime numbers and factoring them. Gregor's favorite prime number is $$$P$$$. Gregor wants to find two bases of $$$P$$$. Formally, Gregor is looking for two integers $$$a$$$ and $$$b$$$ which satisfy bo...
800
true
false
false
false
false
false
false
false
false
false
2,900
1714A
Vlad, like everyone else, loves to sleep very much. Every day Vlad has to do $$$n$$$ things, each at a certain time. For each of these things, he has an alarm clock set, the $$$i$$$-th of them is triggered on $$$h_i$$$ hours $$$m_i$$$ minutes every day ($$$0 le h_i < 24, 0 le m_i < 60$$$). Vlad uses the $$$24$$$-hour t...
900
true
false
true
false
false
false
false
false
false
false
2,000
949E
It is never too late to play the fancy "Binary Cards" game! There is an infinite amount of cards of positive and negative ranks that are used in the game. The absolute value of any card rank is a power of two, i.e. each card has a rank of either 2_k_ or u2009-u20092_k_ for some integer _k_u2009≥u20090. There is an infi...
2,700
false
false
false
false
false
false
true
false
false
false
5,920
1946A
You are given an array $$$a$$$ of $$$n$$$ integers. The median of an array $$$q_1, q_2, ldots, q_k$$$ is the number $$$p_{lceil frac{k}{2} ceil}$$$, where $$$p$$$ is the array $$$q$$$ sorted in non-decreasing order. For example, the median of the array $$$[9, 5, 1, 2, 6]$$$ is $$$5$$$, as in the sorted array $$$[1, 2,...
800
false
true
true
false
false
false
false
false
true
false
605
629B
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has _n_ friends and each of them can come to the party in a specific range of days of the year from _a__i_ to _b__i_. Of course, Famil Door wants to have as many friends celebrating together with him as possible. Far cars are as weird as ...
1,100
false
false
false
false
false
false
true
false
false
false
7,308
847B
Ivan has an array consisting of _n_ different integers. He decided to reorder all elements in increasing order. Ivan loves merge sort so he decided to represent his array with one or several increasing sequences which he then plans to merge into one sorted array. Ivan represent his array with increasing sequences with ...
1,600
false
false
false
false
true
false
false
true
false
false
6,370
1728F
There are $$$n$$$ fishermen who have just returned from a fishing trip. The $$$i$$$-th fisherman has caught a fish of size $$$a_i$$$. The fishermen will choose some order in which they are going to tell the size of the fish they caught (the order is just a permutation of size $$$n$$$). However, they are not entirely ho...
3,100
false
true
false
false
false
false
false
false
false
false
1,920
182C
Problem - 182C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,000
false
true
false
false
true
false
false
false
false
false
9,112
1413B
All techniques in the ninja world consist of hand seals. At the moment Naruto is learning a new technique, which consists of $$$ncdot m$$$ different seals, denoted by distinct numbers. All of them were written in an $$$n imes m$$$ table. The table is lost now. Naruto managed to remember elements of each row from left t...
1,100
false
false
true
false
false
false
false
false
false
false
3,613
1426D
Kolya got an integer array $$$a_1, a_2, dots, a_n$$$. The array can contain both positive and negative integers, but Kolya doesn't like $$$0$$$, so the array doesn't contain any zeros. Kolya doesn't like that the sum of some subsegments of his array can be $$$0$$$. The subsegment is some consecutive segment of elements...
1,500
false
true
false
false
true
true
false
false
true
false
3,536
6A
Problem - 6A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - sol...
900
false
false
false
false
false
false
true
false
false
false
9,965
785E
Anton likes permutations, especially he likes to permute their elements. Note that a permutation of _n_ elements is a sequence of numbers {_a_1,u2009_a_2,u2009...,u2009_a__n_}, in which every number from 1 to _n_ appears exactly once. One day Anton got a new permutation and started to play with it. He does the followin...
2,200
false
false
false
false
true
false
true
false
false
false
6,629
1499B
You are given a string $$$s$$$, consisting only of characters '0' or '1'. Let $$$s$$$ be the length of $$$s$$$. You are asked to choose some integer $$$k$$$ ($$$k > 0$$$) and find a sequence $$$a$$$ of length $$$k$$$ such that: $$$1 le a_1 < a_2 < dots < a_k le s$$$; $$$a_{i-1} + 1 < a_i$$$ for all $$$i$$$ from $$$2$...
1,000
false
true
true
true
false
false
true
false
false
false
3,174
1870F
You are given positive integers $$$n$$$ and $$$k$$$. For each number from $$$1$$$ to $$$n$$$, we write its representation in the number system with base $$$k$$$ (without leading zeros) and then sort the resulting array in lexicographic order as strings. In the sorted array, we number the elements from $$$1$$$ to $$$n$$...
2,900
true
false
false
false
false
false
false
true
false
false
1,054
2008E
Sakurako really loves alternating strings. She calls a string $$$s$$$ of lowercase Latin letters an alternating string if characters in the even positions are the same, if characters in the odd positions are the same, and the length of the string is even. For example, the strings 'abab' and 'gg' are alternating, while ...
1,500
false
true
true
true
true
false
true
false
false
false
204
1038B
Find out if it is possible to partition the first $$$n$$$ positive integers into two non-empty disjoint sets $$$S_1$$$ and $$$S_2$$$ such that: $$$mathrm{gcd}(mathrm{sum}(S_1), mathrm{sum}(S_2)) > 1$$$ Here $$$mathrm{sum}(S)$$$ denotes the sum of all elements present in set $$$S$$$ and $$$mathrm{gcd}$$$ means the Outpu...
1,100
true
false
false
false
false
true
false
false
false
false
5,507
1921F
You are given an array $$$a$$$ of $$$n$$$ numbers. There are also $$$q$$$ queries of the form $$$s, d, k$$$. For each query $$$q$$$, find the sum of elements $$$a_s + a_{s+d} cdot 2 + dots + a_{s + d cdot (k - 1)} cdot k$$$. In other words, for each query, it is necessary to find the sum of $$$k$$$ elements of the arra...
1,900
true
false
true
true
true
false
true
false
false
false
760
47B
Problem - 47B - 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,200
false
false
true
false
false
false
false
false
false
false
9,741
1936E
You are given a permutation $$$p$$$ of length $$$n$$$. Please count the number of permutations $$$q$$$ of length $$$n$$$ which satisfy the following: for each $$$1 le i < n$$$, $$$max(q_1,ldots,q_i) eq max(p_1,ldots,p_i)$$$. Since the answer may be large, output the answer modulo $$$998,244,353$$$. Input Each test co...
3,400
true
false
false
false
false
false
false
false
false
false
664
1992D
ErnKor is ready to do anything for Julen, even to swim through crocodile-infested swamps. We decided to test this love. ErnKor will have to swim across a river with a width of $$$1$$$ meter and a length of $$$n$$$ meters. The river is very cold. Therefore, in total (that is, throughout the entire swim from $$$0$$$ to $...
1,200
false
true
true
true
false
false
false
false
false
false
316
1407C
This is an interactive problem. We hid from you a permutation $$$p$$$ of length $$$n$$$, consisting of the elements from $$$1$$$ to $$$n$$$. You want to guess it. To do that, you can give us 2 different indices $$$i$$$ and $$$j$$$, and we will reply with $$$p_{i} bmod p_{j}$$$ (remainder of division $$$p_{i}$$$ by $$$p...
1,600
true
false
false
false
false
true
false
false
false
false
3,639
40B
Problem - 40B - Codeforces =============== xa0 ") . This process continues ad infinitum. You have to figure out how many squares we repainted exactly _x_ times. The upper left square of the board has to be assumed to be always black. Two squares are called corner-adjacent, if they have exactly one com...
1,600
true
false
false
false
false
false
false
false
false
false
9,788
1858C
Alex got a new game called "GCD permutations" as a birthday present. Each round of this game proceeds as follows: First, Alex chooses a permutation$$$^{dagger}$$$ $$$a_1, a_2, ldots, a_n$$$ of integers from $$$1$$$ to $$$n$$$. Then, for each $$$i$$$ from $$$1$$$ to $$$n$$$, an integer $$$d_i = gcd(a_i, a_{(i bmod n) ...
1,000
true
true
false
false
false
true
false
false
false
false
1,135
1401C
You are given an array $$$a_1, a_2, dots, a_n$$$ where all $$$a_i$$$ are integers and greater than $$$0$$$. In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 le i, j le n$$$). If $$$gcd(a_i, a_j)$$$ is equal to the minimum element of the whole array $$$a$$$, you can swap $$$a_i$$$ and $$$...
1,300
true
false
false
false
false
true
false
false
true
false
3,663
1857A
You are given an array consisting of $$$n$$$ integers. Your task is to determine whether it is possible to color all its elements in two colors in such a way that the sums of the elements of both colors have the same parity and each color has at least one element colored. For example, if the array is [$$$1,2,4,3,2,3,5,...
800
true
true
false
false
false
false
false
false
false
false
1,144
1658A
Today, Marin is at a cosplay exhibition and is preparing for a group photoshoot! For the group picture, the cosplayers form a horizontal line. A group picture is considered beautiful if for every contiguous segment of at least $$$2$$$ cosplayers, the number of males does not exceed the number of females (obviously). Cu...
800
true
false
true
false
false
true
false
false
false
false
2,339
459D
Problem - 459D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,800
false
false
false
false
true
false
false
false
true
false
8,003
215E
Problem - 215E - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,100
false
false
false
true
false
false
false
false
false
false
8,977
354C
Problem - 354C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,100
false
false
false
true
false
false
true
false
false
false
8,416
1142E
This is an interactive task. Scientists are about to invent a new optimization for the Floyd-Warshall algorithm, which will allow it to work in linear time. There is only one part of the optimization still unfinished. It is well known that the Floyd-Warshall algorithm takes a graph with $$$n$$$ nodes and exactly one ed...
3,200
false
false
false
false
false
false
false
false
false
true
5,009
353D
There are _n_ schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The buns aren't ready yet and the line is undergoing some changes. Each second all boys that stand right in front of girls, simultaneously swap places with the girls (so that the girls could go closer to the beginnin...
2,000
false
false
false
true
false
true
false
false
false
false
8,420
268D
Manao is working for a construction company. Recently, an order came to build wall bars in a children's park. Manao was commissioned to develop a plan of construction, which will enable the company to save the most money. After reviewing the formal specifications for the wall bars, Manao discovered a number of controve...
2,300
false
false
false
true
false
false
false
false
false
false
8,760
910C
Petya has _n_ positive integers _a_1,u2009_a_2,u2009...,u2009_a__n_. His friend Vasya decided to joke and replaced all digits in Petya's numbers with a letters. He used the lowercase letters of the Latin alphabet from 'a' to 'j' and replaced all digits 0 with one letter, all digits 1 with another letter and so on. For ...
1,700
true
true
false
false
false
true
false
false
false
false
6,104
547E
What-The-Fatherland is a strange country! All phone numbers there are strings consisting of lowercase English letters. What is double strange that a phone number can be associated with several bears! In that country there is a rock band called CF consisting of _n_ bears (including Mike) numbered from 1 to _n_. Phone nu...
2,800
false
false
false
false
true
false
false
false
false
false
7,648
1085C
The Squareland national forest is divided into equal $$$1 imes 1$$$ square plots aligned with north-south and east-west directions. Each plot can be uniquely described by integer Cartesian coordinates $$$(x, y)$$$ of its south-west corner. Three friends, Alice, Bob, and Charlie are going to buy three distinct plots of...
1,600
true
false
true
false
false
false
false
false
false
false
5,297
2003A
Turtle thinks a string $$$s$$$ is a good string if there exists a sequence of strings $$$t_1, t_2, ldots, t_k$$$ ($$$k$$$ is an arbitrary integer) such that: $$$k ge 2$$$. $$$s = t_1 + t_2 + ldots + t_k$$$, where $$$+$$$ represents the concatenation operation. For example, $$$ exttt{abc} = exttt{a} + exttt{bc}$$$. ...
800
false
true
false
false
false
false
false
false
false
false
239