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
645D
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as possible. When she covers the 2016 Robot Rap Battle Tournament, she notices that all of the robots o...
1,800
false
false
false
true
false
false
false
true
false
true
7,231
1290D
This is the hard version of the problem. You can find the easy version in the Div. 2 contest. Both versions only differ in the number of times you can ask your friend to taste coffee. This is an interactive problem. You're considering moving to another city, where one of your friends already lives. There are $$$n$$$ ca...
3,000
false
false
false
false
false
true
false
false
false
true
4,243
350E
Valera conducts experiments with algorithms that search for shortest paths. He has recently studied the Floyd's algorithm, so it's time to work with it. Valera's already written the code that counts the shortest distance between any pair of vertexes in a non-directed connected graph from _n_ vertexes and _m_ edges, con...
2,200
false
false
false
false
false
true
true
false
false
true
8,431
2037D
Mualani loves surfing on her sharky surfboard! Mualani's surf path can be modeled by a number line. She starts at position $$$1$$$, and the path ends at position $$$L$$$. When she is at position $$$x$$$ with a jump power of $$$k$$$, she can jump to any integer position in the interval $$$[x, x+k]$$$. Initially, her jum...
1,300
false
true
false
false
true
false
false
false
false
false
42
1182F
Problem - 1182F - 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,700
false
false
false
false
true
false
false
true
false
false
4,803
518E
After bracket sequences Arthur took up number theory. He has got a new favorite sequence of length _n_ (_a_1,u2009_a_2,u2009...,u2009_a__n_), consisting of integers and integer _k_, not exceeding _n_. This sequence had the following property: if you write out the sums of all its segments consisting of _k_ consecutive e...
2,200
true
true
true
false
false
false
false
false
false
false
7,764
1214E
It's Petya's birthday party and his friends have presented him a brand new "Electrician-$$$n$$$" construction set, which they are sure he will enjoy as he always does with weird puzzles they give him. Construction set "Electrician-$$$n$$$" consists of $$$2n - 1$$$ wires and $$$2n$$$ light bulbs. Each bulb has its own u...
2,000
true
false
false
false
false
true
false
false
true
true
4,607
518B
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string _s_ of length _n_, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string _s...
1,400
false
true
true
false
false
false
false
false
false
false
7,767
1497E2
This is the hard version of the problem. The only difference is that in this version $$$0 leq k leq 20$$$. There is an array $$$a_1, a_2, ldots, a_n$$$ of $$$n$$$ positive integers. You should divide it into a minimal number of continuous segments, such that in each segment there are no two numbers (on different positi...
2,500
true
true
false
true
true
false
false
false
false
false
3,182
990C
A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()()", "(())" are regu...
1,500
false
false
true
false
false
false
false
false
false
false
5,750
570C
Daniel has a string _s_, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replacement as the following sequence of steps: find a substring ".." (two consecutive periods) in string _s_, of all occurrences of the substring let's choose the first one, and replace thi...
1,600
false
false
true
false
true
true
false
false
false
false
7,569
2022D2
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 978 (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,700
false
false
false
true
false
true
false
false
false
false
134
1006F
There is a rectangular grid of size $$$n imes m$$$. Each cell has a number written on it; the number on the cell ($$$i, j$$$) is $$$a_{i, j}$$$. Your task is to calculate the number of paths from the upper-left cell ($$$1, 1$$$) to the bottom-right cell ($$$n, m$$$) meeting the following constraints: You can move to ...
2,100
false
false
false
true
false
false
true
false
false
false
5,650
18B
Problem - 18B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so...
1,700
true
false
false
false
false
false
true
false
false
false
9,904
1559D1
This is the easy version of the problem. The only difference between the two versions is the constraint on $$$n$$$. You can make hacks only if all versions of the problem are solved. A forest is an undirected graph without cycles (not necessarily connected). Mocha and Diana are friends in Zhijiang, both of them have a ...
1,400
false
true
false
false
false
true
true
false
false
true
2,833
514E
When Darth Vader gets bored, he sits down on the sofa, closes his eyes and thinks of an infinite rooted tree where each node has exactly _n_ sons, at that for each node, the distance between it an its _i_-th left child equals to _d__i_. The Sith Lord loves counting the number of nodes in the tree that are at a distance...
2,200
false
false
false
true
false
false
false
false
false
false
7,776
1451C
Ashish has two strings $$$a$$$ and $$$b$$$, each of length $$$n$$$, and an integer $$$k$$$. The strings only contain lowercase English letters. He wants to convert string $$$a$$$ into string $$$b$$$ by performing some (possibly zero) operations on $$$a$$$. In one move, he can either choose an index $$$i$$$ ($$$1 leq i...
1,400
false
true
true
true
false
false
false
false
false
false
3,426
1838F
This is an interactive problem. There is an $$$n$$$ by $$$n$$$ grid of conveyor belts, in positions $$$(1, 1)$$$ through $$$(n, n)$$$ of a coordinate plane. Every other square in the plane is empty. Each conveyor belt can be configured to move boxes up ('^'), down ('v'), left ('<'), or right ('>'). If a box moves onto ...
3,000
false
false
false
false
false
true
false
true
false
false
1,259
351A
Jeff got 2_n_ real numbers _a_1,u2009_a_2,u2009...,u2009_a_2_n_ as a birthday present. The boy hates non-integer numbers, so he decided to slightly "adjust" the numbers he's got. Namely, Jeff consecutively executes _n_ operations, each of them goes as follows: choose indexes _i_ and _j_ (_i_u2009≠u2009_j_) that haven'...
1,800
true
true
true
true
false
false
false
false
false
false
8,430
961E
One day Polycarp decided to rewatch his absolute favourite episode of well-known TV series "Tufurama". He was pretty surprised when he got results only for season 7 episode 3 with his search query of "Watch Tufurama season 3 episode 7 online full hd free". This got Polycarp confused — what if he decides to rewatch the ...
1,900
false
false
false
false
true
false
false
false
false
false
5,859
1935C
In the new messenger for the students of the Master's Assistance Center, Keftemerum, an update is planned, in which developers want to optimize the set of messages shown to the user. There are a total of $$$n$$$ messages. Each message is characterized by two integers $$$a_i$$$ and $$$b_i$$$. The time spent reading the ...
1,800
false
true
false
true
true
true
true
true
true
false
672
22C
Bob got a job as a system administrator in X corporation. His first task was to connect _n_ servers with the help of _m_ two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair o...
1,700
false
false
false
false
false
false
false
false
false
true
9,886
1787F
A permutation scientist is studying a self-transforming permutation $$$a$$$ consisting of $$$n$$$ elements $$$a_1,a_2,ldots,a_n$$$. 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]$$$ are permutations, while...
2,500
true
false
true
false
false
true
false
false
false
false
1,558
1175D
Problem - 1175D - 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
false
true
false
false
false
false
false
false
true
false
4,842
1487D
A Pythagorean triple is a triple of integer numbers $$$(a, b, c)$$$ such that it is possible to form a right triangle with the lengths of the first cathetus, the second cathetus and the hypotenuse equal to $$$a$$$, $$$b$$$ and $$$c$$$, respectively. An example of the Pythagorean triple is $$$(3, 4, 5)$$$. Vasya studies...
1,500
true
false
false
false
false
false
true
true
false
false
3,243
1879D
Problem - 1879D - 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,700
true
false
false
true
false
false
false
false
false
false
1,007
1614D1
This is the easy version of the problem. The only difference is maximum value of $$$a_i$$$. Once in Kostomuksha Divan found an array $$$a$$$ consisting of positive integers. Now he wants to reorder the elements of $$$a$$$ to maximize the value of the following function: $$$$$$sum_{i=1}^n operatorname{gcd}(a_1, , a_2, ,...
2,100
false
false
false
true
false
false
false
false
false
false
2,567
1038E
You are given $$$n$$$ blocks, each of them is of the form [color$$$_1$$$valuecolor$$$_2$$$], where the block can also be flipped to get [color$$$_2$$$valuecolor$$$_1$$$]. A sequence of blocks is called valid if the touching endpoints of neighboring blocks have the same color. For example, the sequence of three blocks A...
2,400
false
false
false
true
false
false
true
false
false
true
5,504
1431J
Problem - 1431J - Codeforces =============== xa0 ]( "Kotlin Heroes 5: ICPC Round Announcement") ; array $$$b$$$ is non-decreasing; $$$b_1 oplus b_2 oplus dots oplus b_{2n-1} = 0$$$ ($$$oplus$$$ denotes bitwise XOR operation:
3,400
false
false
false
true
false
false
false
false
false
false
3,500
623D
A MIPT student named Misha has a birthday today, and he decided to celebrate it in his country house in suburban Moscow. _n_ friends came by, and after a typical party they decided to play blind man's buff. The birthday boy gets blindfolded and the other players scatter around the house. The game is played in several r...
2,700
true
true
false
false
false
false
false
false
false
false
7,337
249E
A Russian space traveller Alisa Selezneva, like any other schoolgirl of the late 21 century, is interested in science. She has recently visited the MIT (Moscow Institute of Time), where its chairman and the co-inventor of the time machine academician Petrov told her about the construction of a time machine. During the ...
2,600
true
false
false
false
false
false
false
false
false
false
8,837
1098E
Fedya loves problems involving data structures. Especially ones about different queries on subsegments. Fedya had a nice array $$$a_1, a_2, ldots a_n$$$ and a beautiful data structure. This data structure, given $$$l$$$ and $$$r$$$, $$$1 le l le r le n$$$, could find the greatest integer $$$d$$$, such that $$$d$$$ divi...
3,400
true
false
true
false
false
false
false
true
false
false
5,212
1903A
Theofanis is busy after his and changing the array $$$a_1, a_2, ldots, a_n$$$ to $$$a_1, a_2, ldots, a_{i-1}, ; a_j, a_{j-1}, ldots, a_i, ; a_{j+1}, ldots, a_{n-1}, a_n$$$. The length of the subarray is then $$$j - i + 1$$$. Input The first line contains a single integer $$$t$$$ ($$$1 le t le 100$$$)xa0— the number of ...
800
false
true
false
false
false
false
true
false
true
false
897
1776M
The "Parmigiana di melanzane" is a typical Italian dish. Alessandro and Bianca have very different tastes when it comes to it: Alessandro loves to eat Parmigiana with seafood, but Bianca thinks it is an atrocity! To decide which ingredients to include in the dish they prepare, they play the following game. There are $$...
3,000
false
true
false
true
false
false
false
true
false
false
1,616
601C
Kleofáš is participating in an _n_-thlon - a tournament consisting of _n_ different competitions in _n_ different disciplines (numbered 1 through _n_). There are _m_ participants in the _n_-thlon and each of them participates in all competitions. In each of these _n_ competitions, the participants are given ranks from ...
2,300
true
false
false
true
false
false
false
false
false
false
7,438
1510C
There was no problem about a cactus at the NERC 2020 online round. That's a bad mistake, so judges decided to fix it. You shall not pass to the World Finals 2021 without solving a problem about a cactus! A cactus is a connected undirected graph in which every edge lies on at most one simple cycle. Intuitively, a cactus...
2,900
false
false
false
false
false
false
false
false
false
true
3,125
1223F
Let's look at the following process: initially you have an empty stack and an array $$$s$$$ of the length $$$l$$$. You are trying to push array elements to the stack in the order $$$s_1, s_2, s_3, dots s_{l}$$$. Moreover, if the stack is empty or the element at the top of this stack is not equal to the current element,...
2,600
false
false
false
true
true
false
false
false
false
false
4,554
353A
Valera has got _n_ domino pieces in a row. Each piece consists of two halves — the upper one and the lower one. Each of the halves contains a number from 1 to 6. Valera loves even integers very much, so he wants the sum of the numbers on the upper halves and the sum of the numbers on the lower halves to be even. To do ...
1,200
true
false
true
false
false
false
false
false
false
false
8,423
1933B
You are given an array $$$a_1, a_2, ldots, a_n$$$. In one move, you can perform either of the following two operations: Choose an element from the array and remove it from the array. As a result, the length of the array decreases by $$$1$$$; Choose an element from the array and increase its value by $$$1$$$. You can ...
800
true
false
true
false
false
false
false
false
false
false
686
1185G2
The only difference between easy and hard versions is constraints. Polycarp loves to listen to music, so he never leaves the player, even on the way home from the university. Polycarp overcomes the distance from the university to the house in exactly $$$T$$$ minutes. In the player, Polycarp stores $$$n$$$ songs, each o...
2,600
false
false
false
true
false
false
false
false
false
false
4,772
1320A
Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an...
1,400
true
true
false
true
true
false
false
false
true
false
4,115
1980E
You have been given a matrix $$$a$$$ of size $$$n$$$ by $$$m$$$, containing a permutation of integers from $$$1$$$ to $$$n cdot m$$$. A permutation of $$$n$$$ integers is an array containing all numbers from $$$1$$$ to $$$n$$$ exactly once. For example, the arrays $$$[1]$$$, $$$[2, 1, 3]$$$, $$$[5, 4, 3, 2, 1]$$$ are p...
1,600
true
true
true
false
true
true
false
false
true
false
406
1203F2
The only difference between easy and hard versions is that you should complete all the projects in easy version but this is not necessary in hard version. Polycarp is a very famous freelancer. His current rating is $$$r$$$ units. Some very rich customers asked him to complete some projects for their companies. To compl...
2,300
false
true
false
true
false
false
false
false
false
false
4,676
31A
Problem - 31A - 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,843
519A
A and B are preparing themselves for programming contests. To train their logical thinking and solve problems better, A and B decided to play chess. During the game A wondered whose position is now stronger. For each chess piece we know its weight: the queen's weight is 9, the rook's weight is 5, the bishop's weight...
900
false
false
true
false
false
false
false
false
false
false
7,762
833C
Recently, a wild Krakozyabra appeared at Jelly Castle. It is, truth to be said, always eager to have something for dinner. Its favorite meal is natural numbers (typically served with honey sauce), or, to be more precise, the zeros in their corresponding decimal representations. As for other digits, Krakozyabra dislikes...
2,700
true
true
false
false
false
false
true
false
false
false
6,432
1284A
Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years. There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, ldots, s_{n}$$$ and $$$m$$$ strings $$$t...
800
false
false
true
false
false
false
false
false
false
false
4,274
1979A
Alice and Bob came up with a rather strange game. They have an array of integers $$$a_1, a_2,ldots, a_n$$$. Alice chooses a certain integer $$$k$$$ and tells it to Bob, then the following happens: Bob chooses two integers $$$i$$$ and $$$j$$$ ($$$1 le i < j le n$$$), and then finds the maximum among the integers $$$a_i...
800
false
true
true
false
false
false
true
false
false
false
416
1101F
There are $$$n$$$ cities along the road, which can be represented as a straight line. The $$$i$$$-th city is situated at the distance of $$$a_i$$$ kilometers from the origin. All cities are situated in the same direction from the origin. There are $$$m$$$ trucks travelling from one city to another. Each truck can be de...
2,400
false
false
false
true
false
false
false
true
false
false
5,195
1028E
While discussing a proper problem A for a Codeforces Round, Kostya created a cyclic array of positive integers $$$a_1, a_2, ldots, a_n$$$. Since the talk was long and not promising, Kostya created a new cyclic array $$$b_1, b_2, ldots, b_{n}$$$ so that $$$b_i = (a_i mod a_{i + 1})$$$, where we take $$$a_{n+1} = a_1$$$....
2,400
false
false
false
false
false
true
false
false
false
false
5,565
256E
Little Maxim loves interesting problems. He decided to share one such problem with you. Initially there is an array _a_, consisting of _n_ zeroes. The elements of the array are indexed, starting from 1. Then follow queries to change array _a_. Each query is characterized by two integers _v__i_,u2009_t__i_. In the answe...
2,400
false
false
false
false
true
false
false
false
false
false
8,808
1420C2
This is the hard version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved. Pikachu is a cute and friendly pokémon living in the wild pikachu herd. But it has become known recently that infamous team R w...
2,100
false
true
true
true
true
false
false
false
false
false
3,577
2036C
While rummaging through things in a distant drawer, Anya found a beautiful string $$$s$$$ consisting only of zeros and ones. Now she wants to make it even more beautiful by performing $$$q$$$ operations on it. Each operation is described by two integers $$$i$$$ ($$$1 le i le s$$$) and $$$v$$$ ($$$v in {0, 1}$$$) and me...
1,100
false
false
true
false
false
false
true
false
false
false
50
896D
Lakhesh loves to make movies, so Nephren helps her run a cinema. We may call it No. 68 Cinema. However, one day, the No. 68 Cinema runs out of changes (they don't have 50-yuan notes currently), but Nephren still wants to start their business. (Assume that yuan is a kind of currency in Regulu Ere.) There are three types...
2,900
true
false
false
false
false
false
false
false
false
false
6,162
1967A
You have some cards. An integer between $$$1$$$ and $$$n$$$ is written on each card: specifically, for each $$$i$$$ from $$$1$$$ to $$$n$$$, you have $$$a_i$$$ cards which have the number $$$i$$$ written on them. There is also a shop which contains unlimited cards of each type. You have $$$k$$$ coins, so you can buy $$...
1,400
true
true
true
false
false
false
false
true
true
false
508
1283D
There are $$$n$$$ Christmas trees on an infinite number line. The $$$i$$$-th tree grows at the position $$$x_i$$$. All $$$x_i$$$ are guaranteed to be distinct. Each integer point can be either occupied by the Christmas tree, by the human or not occupied at all. Non-integer points cannot be occupied by anything. There a...
1,800
false
true
false
false
false
false
false
false
false
true
4,277
1363D
2,100
true
false
true
false
false
false
false
true
false
false
3,865
1346B
Berland State University (BSU) is conducting a programming boot camp. The boot camp will last for $$$n$$$ days, and the BSU lecturers are planning to give some number of lectures during these days. Some days of the boot camp are already planned as excursion days, and no lectures should be held during these days. To mak...
1,400
false
true
false
false
false
false
false
false
false
false
3,978
88B
Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has _n_ rows of keys containing _m_ keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some of the keys work like the "Shift" key on standard keyboards, that is, they m...
1,500
false
false
true
false
false
false
false
false
false
false
9,530
1009B
You are given a ternary string (it is a string which consists only of characters '0', '1' and '2'). You can swap any two adjacent (consecutive) characters '0' and '1' (i.e. replace "01" with "10" or vice versa) or any two adjacent (consecutive) characters '1' and '2' (i.e. replace "12" with "21" or vice versa). For exa...
1,400
false
true
true
false
false
false
false
false
false
false
5,641
653E
A tree is a connected undirected graph consisting of _n_ vertices and _n_u2009u2009-u2009u20091 edges. Vertices are numbered 1 through _n_. Limak is a little polar bear. He once had a tree with _n_ vertices but he lost it. He still remembers something about the lost tree though. You are given _m_ pairs of vertices (_a_...
2,400
false
false
false
false
false
false
false
false
false
true
7,200
348A
Problem - 348A - 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
false
false
false
false
false
true
true
false
8,442
984A
Problem - 984A - Codeforces =============== xa0 xa0— the number of numbers on the board. The second line contains $$$n$$$ integers $$$a_1, a_2, ldots, a_n$$$ ($$$1 le a_i le 10^6$$$). Output Print one number that will be left on the board. Examples Input 3 2 1 3 Output 2 Input 3 2 2 2 Output 2 Note I...
800
false
false
false
false
false
false
false
false
true
false
5,781
1920C
Allen has an array $$$a_1, a_2,ldots,a_n$$$. For every positive integer $$$k$$$ that is a divisor of $$$n$$$, Allen does the following: He partitions the array into $$$frac{n}{k}$$$ disjoint subarrays of length $$$k$$$. In other words, he partitions the array into the following subarrays: $$$$$$[a_1,a_2,ldots,a_k],[a_...
1,600
true
false
false
false
false
false
true
false
false
false
770
520A
Problem - 520A - 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
7,757
1614B
The company "Divan's Sofas" is planning to build $$$n + 1$$$ different buildings on a coordinate line so that: the coordinate of each building is an integer number; no two buildings stand at the same point. Let $$$x_i$$$ be the coordinate of the $$$i$$$-th building. To get from the building $$$i$$$ to the building $$...
1,000
false
false
false
false
false
true
false
false
true
false
2,569
909E
You are given a program you want to execute as a set of tasks organized in a dependency graph. The dependency graph is a directed acyclic graph: each task can depend on results of one or several other tasks, and there are no directed circular dependencies between tasks. A task can only be executed if all tasks it depen...
1,900
false
true
false
true
false
false
false
false
false
true
6,108
1739A
There is a chess board of size $$$n imes m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$. Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
800
false
false
true
false
false
false
false
false
false
false
1,853
12E
Problem - 12E - 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...
2,100
false
false
false
false
false
true
false
false
false
false
9,931
229E
Once upon a time an old man and his wife lived by the great blue sea. One day the old man went fishing and caught a real live gold fish. The fish said: "Oh ye, old fisherman! Pray set me free to the ocean and I will grant you with _n_ gifts, any gifts you wish!". Then the fish gave the old man a list of gifts and their...
2,600
true
false
false
true
false
false
false
false
false
false
8,919
1267I
This is an interactive problem. You are the head coach of a chess club. The club has $$$2n$$$ players, each player has some strength which can be represented by a number, and all those numbers are distinct. The strengths of the players are not known to you. You need to select $$$n$$$ players who would represent your cl...
2,600
false
false
true
false
false
true
true
false
true
false
4,355
55B
Problem - 55B - Codeforces =============== xa0 and replaced them with their sum or their product. In the end he got one number. Unfortunately, due to the awful memory he forgot that number, but he remembers four original numbers, sequence of the operations and his surprise because of the v...
1,600
false
false
false
false
false
false
true
false
false
false
9,699
1987D
Alice and Bob are playing a game. Initially, there are $$$n$$$ cakes, with the $$$i$$$-th cake having a tastiness value of $$$a_i$$$. Alice and Bob take turns eating them, with Alice starting first: In her turn, Alice chooses and eats any remaining cake whose tastiness is strictly greater than the maximum tastiness of...
1,800
false
false
false
true
false
false
false
false
false
false
354
2004C
Alice and Bob have $$$n$$$ items they'd like to split between them, so they decided to play a game. All items have a cost, and the $$$i$$$-th item costs $$$a_i$$$. Players move in turns starting from Alice. In each turn, the player chooses one of the remaining items and takes it. The game goes on until no items are lef...
1,100
false
true
false
false
false
false
false
false
true
false
229
1359E
Problem - 1359E - 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
true
false
false
false
false
false
false
false
false
false
3,887
1807E
This is an interactive problem. If you are unsure how interactive problems work, then it is recommended to read and $$$k$$$ unique piles $$$p_1, p_2, dots, p_k$$$ ($$$1 leq p_i leq n$$$), and the director will return the total weight $$$m_{p_1} + m_{p_2} + dots + m_{p_k}$$$, where $$$m_i$$$ denotes the weight of pile $...
1,300
false
false
true
false
false
false
false
true
false
false
1,431
91A
Problem - 91A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so...
1,500
false
true
false
false
false
false
false
false
false
false
9,522
907B
Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on the following field. Players are making moves by turns. At first move a player can put his chip in any cell of any small field. ...
1,400
false
false
true
false
false
false
false
false
false
false
6,121
1305G
Kuroni isn't good at economics. So he decided to found a new financial pyramid called Antihype. It has the following rules: 1. You can join the pyramid for free and get $$$0$$$ coins. 2. If you are already a member of Antihype, you can invite your friend who is currently not a member of Antihype, and get a number of co...
3,500
false
false
false
true
false
false
true
false
false
true
4,158
1363F
# Rotating Substrings Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes You are given two strings s and t, each of length n and consisting of lowercase Latin alphabets. You want to make s equal to t.You can perform the following operation on s any number of tim...
2,600
false
false
false
true
false
false
false
false
false
false
3,863
1988D
You, the monster killer, want to kill a group of monsters. The monsters are on a tree with $$$n$$$ vertices. On vertex with number $$$i$$$ ($$$1le ile n$$$), there is a monster with $$$a_i$$$ attack points. You want to battle with monsters for $$$10^{100}$$$ rounds. In each round, the following happens in order: 1. All...
2,000
false
false
false
true
false
false
true
false
false
false
344
316E1
By the age of three Smart Beaver mastered all arithmetic operations and got this summer homework from the amazed teacher: You are given a sequence of integers _a_1,u2009_a_2,u2009...,u2009_a__n_. Your task is to perform on it _m_ consecutive operations of the following type: 1. For given numbers _x__i_ and _v__i_ assig...
1,500
false
false
false
false
true
false
true
false
false
false
8,574
1493E
You are given two integers $$$l$$$ and $$$r$$$ in binary representation. Let $$$g(x, y)$$$ be equal to the oplus dots oplus (y-1) oplus y$$$). Let's define $$$f(l, r)$$$ as the maximum of all values of $$$g(x, y)$$$ satisfying $$$l le x le y le r$$$. Output $$$f(l, r)$$$. Input The first line contains a single integer ...
2,600
true
true
false
false
false
true
false
false
false
false
3,204
567D
Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting of _n_ square cells (that is, on a 1u2009×u2009_n_ table). At the beginning of the game Alice puts _k_ ships on the field without telling their positions to Bob. Each ship looks as a 1u2009×u2009_a_ rectangl...
1,700
false
true
false
false
true
false
false
true
true
false
7,581
1263A
You have three piles of candies: red, green and blue candies: the first pile contains only red candies and there are $$$r$$$ candies in it, the second pile contains only green candies and there are $$$g$$$ candies in it, the third pile contains only blue candies and there are $$$b$$$ candies in it. Each day Tanya ea...
1,100
true
false
false
false
false
false
false
false
false
false
4,387
1473B
Let's define a multiplication operation between a string $$$a$$$ and a positive integer $$$x$$$: $$$a cdot x$$$ is the string that is a result of writing $$$x$$$ copies of $$$a$$$ one after another. For example, "abc" $$$cdot~2~=$$$ "abcabc", "a" $$$cdot~5~=$$$ "aaaaa". A string $$$a$$$ is divisible by another string $...
1,000
true
false
false
false
false
false
true
false
false
false
3,316
37E
Having unraveled the Berland Dictionary, the scientists managed to read the notes of the chroniclers of that time. For example, they learned how the chief of the ancient Berland tribe was chosen. As soon as enough pretenders was picked, the following test took place among them: the chief of the tribe took a slab divide...
2,600
false
true
false
false
false
false
false
false
false
true
9,809
1628E
Mihai lives in a town where meteor storms are a common problem. It's annoying, because Mihai has to buy groceries sometimes, and getting hit by meteors isn't fun. Therefore, we ask you to find the most dangerous way to buy groceries so that we can trick him to go there. The town has $$$n$$$ buildings numbered from $$$1...
3,100
false
false
false
false
true
false
false
true
false
false
2,470
637D
A sportsman starts from point _x__start_u2009=u20090 and runs to point with coordinate _x__finish_u2009=u2009_m_ (on a straight line). Also, the sportsman can jump — to jump, he should first take a run of length of not less than _s_ meters (in this case for these _s_ meters his path should have no obstacles), and after...
1,600
false
true
false
true
true
false
false
false
false
false
7,262
550D
An undirected graph is called _k_-regular, if the degrees of all its vertices are equal _k_. An edge of a connected graph is called a bridge, if after removing it the graph is being split into two connected components. Build a connected undirected _k_-regular graph containing at least one bridge, or else state that suc...
1,900
false
false
true
false
false
true
false
false
false
true
7,634
1236A
Alice is playing with some stones. Now there are three numbered heaps of stones. The first of them contains $$$a$$$ stones, the second of them contains $$$b$$$ stones and the third of them contains $$$c$$$ stones. Each time she can do one of two operations: 1. take one stone from the first heap and two stones from the ...
800
true
true
false
false
false
false
true
false
false
false
4,518
1380B
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $$$s = s_1 s_2 dots s_{n}$$$ of length $$$n$$$ where each letter is either R, S or P. While initializing, the bot is choosing a starting index $$$pos$$$ ($$$1 le pos le n$$$), and ...
1,400
false
true
false
false
false
false
false
false
false
false
3,770
1788E
You are given an array $$$a_1, a_2, ldots, a_n$$$ of $$$n$$$ integers. Consider $$$S$$$ as a set of segments satisfying the following conditions. Each element of $$$S$$$ should be in form $$$[x, y]$$$, where $$$x$$$ and $$$y$$$ are integers between $$$1$$$ and $$$n$$$, inclusive, and $$$x leq y$$$. No two segments in...
2,200
false
false
false
true
true
false
false
false
false
false
1,550
2013D
Zhan, tired after the contest, gave the only task that he did not solve during the contest to his friend, Sungat. However, he could not solve it either, so we ask you to try to solve this problem. You are given an array $$$a_1, a_2, ldots, a_n$$$ of length $$$n$$$. We can perform any number (possibly, zero) of operatio...
1,900
false
true
false
false
false
false
false
true
false
false
175
1234B1
The only difference between easy and hard versions are constraints on $$$n$$$ and $$$k$$$. You are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most $$$k$$$ most recent conversations with your friends. Initially, the screen is empty (i.e. the number of displayed conve...
1,000
false
false
true
false
false
false
false
false
false
false
4,524
48F
The New Year celebrations in Berland last _n_ days. Only this year the winter is snowless, that’s why the winter celebrations’ organizers should buy artificial snow. There are _m_ snow selling companies in Berland. Every day the _i_-th company produces _w__i_ cubic meters of snow. Next day the snow thaws and the compan...
2,800
false
true
false
false
false
false
false
false
true
false
9,732
1374E1
, # Reading Books (easy version) Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Easy and hard versions are actually different problems, so read statements of both problems completely and carefully .Summer vacation has started so Alice and Bob want to play a...
1,600
false
true
false
false
true
false
false
false
true
false
3,790
1225D
Problem - 1225D - Codeforces =============== xa0 . The second line contains $$$n$$$ integers $$$a_1, ldots, a_n$$$ ($$$1 leq a_i leq 10^5$$$). Output Print a single integerxa0— the number of suitable pairs. Example Input 6 3 1 3 9 8 24 1 Output 5 Note In the sample case, the suitable pairs are: $$$a_1 cd...
1,800
true
false
false
false
false
false
false
false
false
false
4,548
1023B
Tanechka is shopping in the toy shop. There are exactly $$$n$$$ toys in the shop for sale, the cost of the $$$i$$$-th toy is $$$i$$$ burles. She wants to choose two toys in such a way that their total cost is $$$k$$$ burles. How many ways to do that does she have? Each toy appears in the shop exactly once. Pairs $$$(a,...
1,000
true
false
false
false
false
false
false
false
false
false
5,589
237E
You desperately need to build some string _t_. For that you've got _n_ more strings _s_1,u2009_s_2,u2009...,u2009_s__n_. To build string _t_, you are allowed to perform exactly _t_ (_t_ is the length of string _t_) operations on these strings. Each operation looks like that: 1. choose any non-empty string from strings ...
2,000
false
false
false
false
false
false
false
false
false
true
8,885