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
1925A
You are given two positive integers $$$n$$$ and $$$k$$$. Your task is to find a string $$$s$$$ such that all possible strings of length $$$n$$$ that can be formed using the first $$$k$$$ lowercase English alphabets occur as a subsequence of $$$s$$$. If there are multiple answers, print the one with the smallest length....
800
false
true
false
false
false
true
false
false
false
false
740
754E
Dasha is fond of challenging puzzles: Rubik's Cube 3u2009×u20093u2009×u20093, 4u2009×u20094u2009×u20094, 5u2009×u20095u2009×u20095 and so on. This time she has a cyclic table of size _n_u2009×u2009_m_, and each cell of the table contains a lowercase English letter. Each cell has coordinates (_i_,u2009_j_) (0u2009≤u2009...
2,600
false
false
false
false
false
false
true
false
false
false
6,778
1359D
Alice and Bob are playing yet another card game. This time the rules are the following. There are $$$n$$$ cards lying in a row in front of them. The $$$i$$$-th card has value $$$a_i$$$. First, Alice chooses a non-empty consecutive segment of cards $$$[l; r]$$$ ($$$l le r$$$). After that Bob removes a single card $$$j$$...
2,000
false
false
true
true
true
false
false
false
false
false
3,888
1758F
A binary string is a string where every character is $$$ exttt{0}$$$ or $$$ exttt{1}$$$. Call a binary string decent if it has an equal number of $$$ exttt{0}$$$s and $$$ exttt{1}$$$s. Initially, you have an infinite binary string $$$t$$$ whose characters are all $$$ exttt{0}$$$s. You are given a sequence $$$a$$$ of $$...
3,000
false
false
false
false
true
true
false
false
false
false
1,763
1957A
You are given $$$n$$$ sticks of lengths $$$a_1, a_2, ldots, a_n$$$. Find the maximum number of regular (equal-sided) polygons you can construct simultaneously, such that: Each side of a polygon is formed by exactly one stick. No stick is used in more than $$$1$$$ polygon. Note: Sticks cannot be broken. Input The firs...
800
false
true
false
false
false
true
false
false
false
false
533
2014B
In Sherwood, the trees are our shelter, and we are all children of the forest. The Major Oak in Sherwood is known for its majestic foliage, which provided shelter to Robin Hood and his band of merry men and women. The Major Oak grows $$$i^i$$$ new leaves in the $$$i$$$-th year. It starts with $$$1$$$ leaf in year $$$1$...
800
true
false
false
false
false
false
false
false
false
false
170
16D
The main server of Gomble company received a log of one top-secret process, the name of which can't be revealed. The log was written in the following format: «[date:time]: message», where for each «[date:time]» value existed not more than 10 lines. All the files were encoded in a very complicated manner, and only one p...
1,900
false
false
true
false
false
false
false
false
false
false
9,912
1866I
Given a chessboard of size $$$N imes M$$$ ($$$N$$$ rows and $$$M$$$ columns). Each row is numbered from $$$1$$$ to $$$N$$$ from top to bottom and each column is numbered from $$$1$$$ to $$$M$$$ from left to right. The tile in row $$$r$$$ and column $$$c$$$ is denoted as $$$(r,c)$$$. There exists $$$K$$$ distinct speci...
2,300
false
false
false
true
false
false
false
false
false
false
1,080
407A
Problem - 407A - 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,600
true
false
true
false
false
false
true
false
false
false
8,198
626F
There are _n_ students in a class working on group projects. The students will divide into groups (some students may be in groups alone), work on their independent pieces, and then discuss the results together. It takes the _i_-th student _a__i_ minutes to finish his/her independent piece. If students work at different...
2,400
false
false
false
true
false
false
false
false
false
false
7,323
1392C
Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible. Omkar currently has $$$n$$$ supports arranged in a line, the $$$i$$$-th of which has height $$$a_i$$$. Omkar wants to build his waterslide from the right to the left, so his supports must be no...
1,200
false
true
true
false
false
false
false
false
false
false
3,714
274B
A tree is a graph with _n_ vertices and exactly _n_u2009-u20091 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertices. A subtree of a tree _T_ is a tree with both vertices and edges as subsets of vertices and edges of _T_. You...
1,800
false
true
false
true
false
false
false
false
false
false
8,738
48E
Once upon a time in a kingdom far, far away… Okay, let’s start at the point where Ivan the Fool met Gorynych the Dragon. Ivan took out his magic sword and the battle began. First Gorynych had _h_ heads and _t_ tails. With each strike of the sword Ivan can either cut off several heads (from 1 to _n_, but not more than G...
2,100
false
false
false
true
false
false
false
false
false
true
9,733
1592A
One day, Ahmed_Hossam went to Hemose and said "Let's solve a gym contest!". Hemose didn't want to do that, as he was playing Valorant, so he came up with a problem and told it to Ahmed to distract him. Sadly, Ahmed can't solve it... Could you help him? There is an Agent in Valorant, and he has $$$n$$$ weapons. The $$$i...
800
true
true
false
false
false
false
false
true
true
false
2,693
1850C
On an $$$8 imes 8$$$ grid of dots, a word consisting of lowercase Latin letters is written vertically in one column, from top to bottom. What is it? Input The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 leq t leq 1000$$$)xa0— the number of test cases. Each...
800
false
false
true
false
false
false
false
false
false
false
1,180
1311F
There are $$$n$$$ points on a coordinate axis $$$OX$$$. The $$$i$$$-th point is located at the integer point $$$x_i$$$ and has a speed $$$v_i$$$. It is guaranteed that no two points occupy the same coordinate. All $$$n$$$ points move with the constant speed, the coordinate of the $$$i$$$-th point at the moment $$$t$$$ ...
1,900
false
false
true
false
true
false
false
false
true
false
4,138
776E
The Holmes children are fighting over who amongst them is the cleverest. Mycroft asked Sherlock and Eurus to find value of _f_(_n_), where _f_(1)u2009=u20091 and for _n_u2009≥u20092, _f_(_n_) is the number of distinct ordered positive integer pairs (_x_,u2009_y_) that satisfy _x_u2009+u2009_y_u2009=u2009_n_ and _gcd_(_...
2,100
true
false
false
false
false
false
false
false
false
false
6,664
1738G
You are given an $$$n imes n$$$ grid. We write $$$(i, j)$$$ to denote the cell in the $$$i$$$-th row and $$$j$$$-th column. For each cell, you are told whether yon can delete it or not. Given an integer $$$k$$$, you are asked to delete exactly $$$(n-k+1)^2$$$ cells from the grid such that the following condition holds...
2,900
true
true
false
true
false
true
false
false
false
false
1,855
300C
Problem - 300C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,800
false
false
false
false
false
false
true
false
false
false
8,633
1512B
There is a square field of size $$$n imes n$$$ in which two cells are marked. These cells can be in the same row or column. You are to mark two more cells so that they are the corners of a rectangle with sides parallel to the coordinate axes. For example, if $$$n=4$$$ and a rectangular field looks like this (there are...
800
false
false
true
false
false
false
false
false
false
false
3,108
667A
A lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, contemplate all around you, enjoy freshness, think about big deeds you have to do. Today everything ha...
1,100
true
false
false
false
false
false
false
false
false
false
7,150
2018F2
This is the medium version of the problem. In the three versions, the constraints on $$$n$$$ and the time limit are different. You can make hacks only if all the versions of the problem are solved. This is the statement of Problem D1B: There are $$$n$$$ cities in a row, numbered $$$1, 2, ldots, n$$$ left to right. ...
3,000
true
true
false
true
false
false
false
false
false
false
156
1304A
Being tired of participating in too many Codeforces rounds, Gildong decided to take some rest in a park. He sat down on a bench, and soon he found two rabbits hopping around. One of the rabbits was taller than the other. He noticed that the two rabbits were hopping towards each other. The positions of the two rabbits c...
800
true
false
false
false
false
false
false
false
false
false
4,171
193C
Hamming distance between strings _a_ and _b_ of equal length (denoted by _h_(_a_,u2009_b_)) is equal to the number of distinct integers _i_ (1u2009≤u2009_i_u2009≤u2009_a_), such that _a__i_u2009≠u2009_b__i_, where _a__i_ is the _i_-th symbol of string _a_, _b__i_ is the _i_-th symbol of string _b_. For example, the Ham...
2,400
true
true
false
false
false
true
false
false
false
false
9,068
1583H
Omkar is hosting tours of his country, Omkarland! There are $$$n$$$ cities in Omkarland, and, rather curiously, there are exactly $$$n-1$$$ bidirectional roads connecting the cities to each other. It is guaranteed that you can reach any city from any other city through the road network. Every city has an enjoyment valu...
3,300
false
false
false
false
true
false
false
false
true
false
2,710
1540C1
This is the easy version of the problem. The only difference is that in this version $$$q = 1$$$. You can make hacks only if both versions of the problem are solved. There is a process that takes place on arrays $$$a$$$ and $$$b$$$ of length $$$n$$$ and length $$$n-1$$$ respectively. The process is an infinite sequence...
2,700
true
false
false
true
false
false
false
false
false
false
2,940
1063C
This is an interactive problem. In good old times dwarves tried to develop extrasensory abilities: Exactly _n_ dwarves entered completely dark cave. Each dwarf received a hatxa0— white or black. While in cave, none of the dwarves was able to see either his own hat or hats of other Dwarves. Dwarves went out of the ca...
1,900
false
false
false
false
false
true
false
true
false
false
5,394
1379F2
Note that the difference between easy and hard versions is that in hard version unavailable cells can become available again and in easy version can't. You can make hacks only if all versions are solved. Ildar and Ivan are tired of chess, but they really like the chessboard, so they invented a new game. The field is a ...
2,800
false
false
false
false
true
false
false
false
false
false
3,772
1346F
You're at the last mission in one very old and very popular strategy game Dune II: Battle For Arrakis. The map of the mission can be represented as a rectangular matrix of size $$$n imes m$$$. Initially, there are $$$a_{i, j}$$$ units of your army in the cell $$$(i, j)$$$. You want to prepare for the final battle, so ...
2,000
true
true
false
false
true
false
false
false
false
false
3,974
954H
Problem - 954H - 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
false
true
false
false
false
false
false
false
5,902
15D
There is an area map that is a rectangular matrix _n_u2009×u2009_m_, each cell of the matrix contains the average height of a corresponding area part. Peter works for a company that has to build several cities within this area, each of the cities will occupy a rectangle _a_u2009×u2009_b_ cells on the map. To start cons...
2,500
false
false
true
false
true
false
false
false
true
false
9,917
675B
Problem - 675B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,400
true
false
false
false
false
true
true
false
false
false
7,130
1165E
You are given two arrays $$$a$$$ and $$$b$$$, both of length $$$n$$$. Let's define a function $$$f(l, r) = sumlimits_{l le i le r} a_i cdot b_i$$$. Your task is to reorder the elements (choose an arbitrary order of elements) of the array $$$b$$$ to minimize the value of $$$sumlimits_{1 le l le r le n} f(l, r)$$$. Since...
1,600
true
true
false
false
false
false
false
false
true
false
4,892
840C
Problem - 840C - 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
false
true
false
false
false
false
false
false
6,401
1726H
Mainak has a convex polygon $$$mathcal P$$$ with $$$n$$$ vertices labelled as $$$A_1, A_2, ldots, A_n$$$ in a counter-clockwise fashion. The coordinates of the $$$i$$$-th point $$$A_i$$$ are given by $$$(x_i, y_i)$$$, where $$$x_i$$$ and $$$y_i$$$ are both integers. Further, it is known that the interior angle at $$$A_...
3,500
true
false
true
false
false
false
false
true
false
false
1,926
1263E
The development of a text editor is a hard problem. You need to implement an extra module for brackets coloring in text. Your editor consists of a line with infinite length and cursor, which points to the current character. Please note that it points to only one of the characters (and not between a pair of characters)....
2,100
false
false
true
false
true
false
false
false
false
false
4,383
1054H
Problem - 1054H - Codeforces =============== xa0 . Next line contains exactly $$$n$$$ integers $$$a_i$$$ and defines the array $$$a$$$ ($$$0 le a_i le 1000$$$). Last line contains exactly $$$m$$$ integers $$$b_i$$$ and defines the array $$$b$$$ ($$$0 le b_i le 1000$$$). Output Print one integerxa0— value ...
3,500
true
false
false
false
false
false
false
false
false
false
5,440
354D
Vasya and Petya are using an interesting data storing structure: a pyramid. The pyramid consists of _n_ rows, the _i_-th row contains _i_ cells. Each row is shifted half a cell to the left relative to the previous row. The cells are numbered by integers from 1 to as shown on the picture below. An example of a pyramid a...
2,900
false
false
false
true
false
false
false
false
false
false
8,415
814A
A few years ago, Hitagi encountered a giant crab, who stole the whole of her body weight. Ever since, she tried to avoid contact with others, for fear that this secret might be noticed. To get rid of the oddity and recover her weight, a special integer sequence is needed. Hitagi's sequence has been broken for a long ti...
900
false
true
true
false
false
true
false
false
true
false
6,505
239B
There is a programming language in which every program is a non-empty sequence of "<" and ">" signs and digits. Let's explain how the interpreter of this programming language works. A program is interpreted using movement of instruction pointer (IP) which consists of two parts. Current character pointer (CP); Directi...
1,500
false
false
true
false
false
false
true
false
false
false
8,878
1991E
This is an interactive problem. Consider an undirected connected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. Each vertex can be colored with one of three colors: $$$1$$$, $$$2$$$, or $$$3$$$. Initially, all vertices are uncolored. Alice and Bob are playing a game consisting of $$$n$$$ rounds. In each round,...
1,900
false
true
false
false
false
true
false
false
false
true
324
257C
Problem - 257C - 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
8,805
156C
Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the correspondence, but he couldn't understand anything. At last, after some thought, he thought of something....
2,000
false
false
false
true
false
false
false
false
false
false
9,250
1370A
Problem - 1370A - 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
true
true
false
false
false
false
false
false
false
3,821
1366F
You are given a simple weighted connected undirected graph, consisting of $$$n$$$ vertices and $$$m$$$ edges. A path in the graph of length $$$k$$$ is a sequence of $$$k+1$$$ vertices $$$v_1, v_2, dots, v_{k+1}$$$ such that for each $$$i$$$ $$$(1 le i le k)$$$ the edge $$$(v_i, v_{i+1})$$$ is present in the graph. A pa...
2,700
false
false
false
true
false
false
false
true
false
true
3,845
513G1
You are given a permutation of _n_ numbers _p_1,u2009_p_2,u2009...,u2009_p__n_. We perform _k_ operations of the following type: choose uniformly at random two indices _l_ and _r_ (_l_u2009≤u2009_r_) and reverse the order of the elements _p__l_,u2009_p__l_u2009+u20091,u2009...,u2009_p__r_. Your task is to find the expe...
1,800
false
false
false
true
false
false
true
false
false
false
7,783
1400D
Problem - 1400D - 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,900
true
false
false
false
true
false
true
false
false
false
3,669
1153C
Serval soon said goodbye to Japari kindergarten, and began his life in Japari Primary School. In his favorite math class, the teacher taught him the following interesting definitions. A parenthesis sequence is a string, containing only characters "(" and ")". A correct parenthesis sequence is a parenthesis sequence tha...
1,700
false
true
false
false
false
false
false
false
false
false
4,947
2005E1
This is the easy version of the problem. The differences between the two versions are the constraints on all the variables. You can make hacks only if both versions of the problem are solved. Tsovak and Narek are playing a game. They have an array $$$a$$$ and a matrix $$$b$$$ of integers with $$$n$$$ rows and $$$m$$$ c...
2,100
false
true
true
true
false
false
false
false
false
false
219
1845D
You are developing a rating system for an online game. Every time a player participates in a match, the player's rating changes depending on the results. Initially, the player's rating is $$$0$$$. There are $$$n$$$ matches; after the $$$i$$$-th match, the rating change is equal to $$$a_i$$$ (the rating increases by $$$...
1,800
true
true
false
true
true
false
true
true
false
false
1,211
1545F
AquaMoon has three integer arrays $$$a$$$, $$$b$$$, $$$c$$$ of length $$$n$$$, where $$$1 leq a_i, b_i, c_i leq n$$$ for all $$$i$$$. In order to accelerate her potato farming, she organizes her farm in a manner based on these three arrays. She is now going to complete $$$m$$$ operations to count how many potatoes she ...
3,500
false
false
false
true
true
false
true
false
false
false
2,916
1368A
Leo has developed a new programming language C+=. In C+=, integer variables can only be changed with a "+=" operation that adds the right-hand side value to the left-hand side variable. For example, performing "a += b" when a = $$$2$$$, b = $$$3$$$ changes the value of a to $$$5$$$ (the value of b does not change). In ...
800
true
true
true
false
false
false
true
false
false
false
3,836
1991I
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Pinely Round 4 (Div. 1 + 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....
3,500
false
true
false
false
false
true
false
false
false
false
320
1721F
You are given a bipartite graph with $$$n_1$$$ vertices in the first part, $$$n_2$$$ vertices in the second part, and $$$m$$$ edges. The maximum matching in this graph is the maximum possible (by size) subset of edges of this graph such that no vertex is incident to more than one chosen edge. You have to process two ty...
2,800
false
false
false
false
false
true
true
false
false
true
1,954
995E
Problem - 995E - Codeforces =============== xa0 ]( "Codeforces Round #492 . $$$p$$$ is guaranteed to be prime. Output On the first line, print a single integer $$$ell$$$, the number of button presses. On the second line, print integers $$$c_1, dots, c_ell$$$, the button presses. For $$$1 le i le ell$$$, $$$1 ...
2,700
false
false
false
false
false
false
false
false
false
true
5,722
1698A
There is an array $$$a$$$ with $$$n-1$$$ integers. Let $$$x$$$ be the , and then the elements are shuffled. You are given the newly formed array $$$a$$$. What is $$$x$$$? If there are multiple possible values of $$$x$$$, you can output any of them. Input The input consists of multiple test cases. The first line contain...
800
false
false
false
false
false
false
true
false
false
false
2,094
1446D2
This is the hard version of the problem. The difference between the versions is in the constraints on the array elements. 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]$$$. Your goal is to find the length of the longest subarray of this array such that...
3,000
false
true
false
false
true
false
false
false
false
false
3,443
1536D
Uh oh! Ray lost his array yet again! However, Omkar might be able to help because he thinks he has found the OmkArray of Ray's array. The OmkArray of an array $$$a$$$ with elements $$$a_1, a_2, ldots, a_{2k-1}$$$, is the array $$$b$$$ with elements $$$b_1, b_2, ldots, b_{k}$$$ such that $$$b_i$$$ is equal to the median...
2,000
false
true
true
false
true
false
false
false
false
false
2,965
1172A
Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are $$$n$$$ cards numbered from $$$1$$$ to $$$n$$$, and they were mixed with another $$$n$$$ empty cards. She piled up the $$$2n$$$ cards and drew $$$n$$$ of them. The $$$n$$$ cards in ...
1,800
false
true
true
false
false
false
false
false
false
false
4,860
740A
Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook for _a_ rubles, a pack of two copybooks for _b_ rubles, and a pack ...
1,300
false
false
true
false
false
false
true
false
false
false
6,838
1474A
In the $$$2022$$$ year, Mike found two binary integers $$$a$$$ and $$$b$$$ of length $$$n$$$ (both of them are written only by digits $$$0$$$ and $$$1$$$) that can have leading zeroes. In order not to forget them, he wanted to construct integer $$$d$$$ in the following way: he creates an integer $$$c$$$ as a result of...
800
false
true
false
false
false
false
false
false
false
false
3,310
1267L
Problem - 1267L - 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,800
false
false
false
false
false
true
false
false
false
false
4,352
1698B
There are $$$n$$$ piles of sand where the $$$i$$$-th pile has $$$a_i$$$ blocks of sand. The $$$i$$$-th pile is called too tall if $$$1 < i < n$$$ and $$$a_i > a_{i-1} + a_{i+1}$$$. That is, a pile is too tall if it has more sand than its two neighbours combined. (Note that piles on the ends of the array cannot be too t...
800
false
true
true
false
false
true
false
false
false
false
2,093
610B
Vika has _n_ jars with paints of distinct colors. All the jars are numbered from 1 to _n_ and the _i_-th jar contains _a__i_ liters of paint of color _i_. Vika also has an infinitely long rectangular piece of paper of width 1, consisting of squares of size 1u2009×u20091. Squares are numbered 1, 2, 3 and so on. Vika dec...
1,300
false
false
true
false
false
true
false
false
false
false
7,405
1981D
Turtle just learned how to multiply two integers in his math class, and he was very excited. Then Piggy gave him an integer $$$n$$$, and asked him to construct a sequence $$$a_1, a_2, ldots, a_n$$$ consisting of integers which satisfied the following conditions: For all $$$1 le i le n$$$, $$$1 le a_i le 3 cdot 10^5$$$...
2,400
false
false
false
false
false
true
false
false
false
true
399
1210A
Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every $$$a$$$ and $$$b$$$ such that $$$1 leq a leq b leq 6$$$, there is exactly one domino with $$$a$$$ dots on one half and $$$b$$$ dots on the other half. The set contains exactly $$$21$$$ dominoes. Here is an exact illustr...
1,700
false
false
false
false
false
false
true
false
false
true
4,636
1415C
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty. In order to pass a level, a player must throw a ball from t...
1,400
false
false
true
true
false
false
true
false
false
false
3,606
271B
You've got an _n_u2009×u2009_m_ matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times. You are really curious about prime numbers. Let us remind...
1,300
true
false
false
false
false
false
true
true
false
false
8,750
1550E
You are given a string $$$s$$$ of length $$$n$$$. Each character is either one of the first $$$k$$$ lowercase Latin letters or a question mark. You are asked to replace every question mark with one of the first $$$k$$$ lowercase Latin letters in such a way that the following value is maximized. Let $$$f_i$$$ be the max...
2,500
false
false
false
true
false
false
true
true
false
false
2,894
67C
You are given a sequence of balls _A_ by your teacher, each labeled with a lowercase Latin letter 'a'-'z'. You don't like the given sequence. You want to change it into a new sequence, _B_ that suits you better. So, you allow yourself four operations: You can insert any ball with any label into the sequence at any pos...
2,600
false
false
false
true
false
false
false
false
false
false
9,634
1029D
You are given an array $$$a$$$, consisting of $$$n$$$ positive integers. Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ i...
1,900
true
false
true
false
false
false
false
false
false
false
5,558
380A
Sereja loves number sequences very much. That's why he decided to make himself a new one following a certain algorithm. Sereja takes a blank piece of paper. Then he starts writing out the sequence in _m_ stages. Each time he either adds a new number to the end of the sequence or takes _l_ first elements of the current ...
1,600
false
false
false
false
false
false
true
true
false
false
8,310
1076F
Vova has taken his summer practice this year and now he should write a report on how it went. Vova has already drawn all the tables and wrote down all the formulas. Moreover, he has already decided that the report will consist of exactly $$$n$$$ pages and the $$$i$$$-th page will include $$$x_i$$$ tables and $$$y_i$$$ ...
2,500
false
true
false
true
false
false
false
false
false
false
5,339
1324F
You are given a tree consisting of $$$n$$$ vertices. A tree is a connected undirected graph with $$$n-1$$$ edges. Each vertex $$$v$$$ of this tree has a color assigned to it ($$$a_v = 1$$$ if the vertex $$$v$$$ is white and $$$0$$$ if the vertex $$$v$$$ is black). You have to solve the following problem for each vertex...
1,800
false
false
false
true
false
false
false
false
false
true
4,094
370D
Innocentius has a problem — his computer monitor has broken. Now some of the pixels are "dead", that is, they are always black. As consequence, Innocentius can't play the usual computer games. He is recently playing the following game with his younger brother Polycarpus. Innocentius is touch-typing a program that paint...
2,100
false
true
true
false
false
true
true
false
false
false
8,350
1107F
Vasya wants to buy himself a nice new car. Unfortunately, he lacks some money. Currently he has exactly 0 burles. However, the local bank has $$$n$$$ credit offers. Each offer can be described with three numbers $$$a_i$$$, $$$b_i$$$ and $$$k_i$$$. Offers are numbered from $$$1$$$ to $$$n$$$. If Vasya takes the $$$i$$$-...
2,600
false
false
false
true
false
false
false
false
true
true
5,164
1214G
Recently biologists came to a fascinating conclusion about how to find a chameleon mood. Consider chameleon body to be a rectangular table $$$n imes m$$$, each cell of which may be green or blue and may change between these two colors. We will denote as $$$(x, y)$$$ ($$$1 leq x leq n$$$, $$$1 leq y leq m$$$) the cell ...
3,200
false
false
false
false
true
false
false
false
false
false
4,605
1999D
Slavic has a very tough exam and needs your help in order to pass it. Here is the question he is struggling with: There exists a string $$$s$$$, which consists of lowercase English letters and possibly zero or more "?". Slavic is asked to change each "?" to a lowercase English letter such that string $$$t$$$ becomes a ...
1,100
false
true
true
false
false
false
false
false
false
false
268
79D
Finally Fox Ciel arrived in front of her castle! She have to type a password to enter her castle. An input device attached to her castle is a bit unusual. The input device is a 1u2009×u2009_n_ rectangle divided into _n_ square panels. They are numbered 1 to _n_ from left to right. Each panel has a state either ON or OF...
2,800
false
false
false
true
false
false
false
false
false
false
9,567
821A
Okabe needs to renovate the Future Gadget Laboratory after he tried doing some crazy experiments! The lab is represented as an _n_ by _n_ square grid of integers. A good lab is defined as a lab in which every number not equal to 1 can be expressed as the sum of a number in the same row and a number in the same column. ...
800
false
false
true
false
false
false
false
false
false
false
6,473
1995D
You're a linguist studying a mysterious ancient language. You know that 1. Its words consist only of the first $$$c$$$ letters of the Latin alphabet. 2. Each word has a case which can be unambiguously determined by its last letter (different letters correspond to different cases). For example, words "ABACABA" and "ABA"...
2,300
false
false
false
true
false
false
true
false
false
false
293
1443E
A permutation is a sequence of integers from $$$1$$$ to $$$n$$$ of length $$$n$$$ containing each number exactly once. For example, $$$[1]$$$, $$$[4, 3, 5, 1, 2]$$$, $$$[3, 2, 1]$$$xa0— are permutations, and $$$[1, 1]$$$, $$$[4, 3, 1]$$$, $$$[2, 3, 4]$$$xa0— no. Permutation $$$a$$$ is lexicographically smaller than per...
2,400
true
false
false
false
false
false
true
false
false
false
3,455
1605D
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 754 (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,100
false
true
true
false
false
true
false
false
false
false
2,632
1994B
Vova really loves the . Recently, when he was going to sleep, he came up with a fun game. At the beginning of the game, Vova chooses two binary sequences $$$s$$$ and $$$t$$$ of length $$$n$$$ and gives them to Vanya. A binary sequence is a sequence consisting only of the numbers $$$0$$$ and $$$1$$$. Vanya can choose in...
1,100
true
true
false
false
false
true
false
false
false
false
304
49D
Problem - 49D - 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,800
false
false
true
true
false
false
true
false
false
false
9,726
1479E
In Homer's school, there are $$$n$$$ students who love clubs. Initially, there are $$$m$$$ clubs, and each of the $$$n$$$ students is in exactly one club. In other words, there are $$$a_i$$$ students in the $$$i$$$-th club for $$$1 leq i leq m$$$ and $$$a_1+a_2+dots+a_m = n$$$. The $$$n$$$ students are so unfriendly th...
3,500
true
false
false
true
false
false
false
false
false
false
3,276
263E
Problem - 263E - 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
false
true
true
false
true
false
false
false
8,779
762E
In the lattice points of the coordinate line there are _n_ radio stations, the _i_-th of which is described by three integers: _x__i_ — the coordinate of the _i_-th station on the line, _r__i_ — the broadcasting range of the _i_-th station, _f__i_ — the broadcasting frequency of the _i_-th station. We will say that ...
2,200
false
false
false
false
true
false
false
true
false
false
6,739
400C
Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to _n_ from top to bottom and the columns — from 1 to _m_, from left to right. We'll represent the cell on the intersection of the _i_-th row and _j_-th column as...
1,500
true
false
true
false
false
false
false
false
false
false
8,225
822A
Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university of her dreams which is located in a town Pavlopolis. It's well known that universities provide students with dormitory for the period of university studies. Consequently Noora had to leave Vičkopolis and move to Pavlopo...
800
true
false
true
false
false
false
false
false
false
false
6,468
55D
Problem - 55D - Codeforces =============== xa0 . Each of the next _t_ lines contains two natural numbers _l__i_ and _r__i_ (1u2009≤u2009_l__i_u2009≤u2009_r__i_u2009≤u20099u2009·1018). Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cin (...
2,500
false
false
false
true
false
false
false
false
false
false
9,697
154B
By 2312 there were _n_ Large Hadron Colliders in the inhabited part of the universe. Each of them corresponded to a single natural number from 1 to _n_. However, scientists did not know what activating several colliders simultaneously could cause, so the colliders were deactivated. In 2312 there was a startling discove...
1,600
true
false
false
false
false
false
false
false
false
false
9,258
940A
We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding another problem to the round. The diameter of a multiset of points on the line is the largest distance between two points from this set. For example, the diameter of the multiset {1,u20093,u20092,u20091} i...
1,200
false
true
false
false
false
false
true
false
true
false
5,938
340B
Problem - 340B - 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
false
false
false
true
false
false
false
8,474
1996F
Sparkle gives you two arrays $$$a$$$ and $$$b$$$ of length $$$n$$$. Initially, your score is $$$0$$$. In one operation, you can choose an integer $$$i$$$ and add $$$a_i$$$ to your score. Then, you must set $$$a_i$$$ = $$$max(0, a_i - b_i)$$$. You only have time to perform $$$k$$$ operations before Sparkle sets off a nu...
1,900
true
true
false
false
false
false
false
true
false
false
285
1156F
You have a bag which contains $$$n$$$ cards. There is a number written on each card; the number on $$$i$$$-th card is $$$a_i$$$. You are playing the following game. During each turn, you choose and remove a random card from the bag (all cards that are still left inside the bag are chosen equiprobably). Nothing else hap...
2,300
true
false
false
true
false
false
false
false
false
false
4,925
712C
Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length _x_, and he wishes to perform operations to obtain an equilateral triangle of side length _y_. In a single second, he can modify the length of a single side of the current triangle such...
1,600
true
true
false
false
false
false
false
false
false
false
6,969
680A
A little bear Limak plays a game. He has five cards. There is one number written on each card. Each number is a positive integer. Limak can discard (throw out) some cards. His goal is to minimize the sum of numbers written on remaining (not discarded) cards. He is allowed to at most once discard two or three cards with...
800
false
false
true
false
false
true
false
false
false
false
7,105
504E
Misha has a tree with characters written on the vertices. He can choose two vertices _s_ and _t_ of this tree and write down characters of vertices lying on a path from _s_ to _t_. We'll say that such string corresponds to pair (_s_,u2009_t_). Misha has _m_ queries of type: you are given 4 vertices _a_, _b_, _c_, _d_; ...
3,000
false
false
false
false
false
false
false
true
false
false
7,824
338E
Problem - 338E - 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,600
false
false
false
false
true
false
false
false
false
false
8,481