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
645E
After getting kicked out of her reporting job for not knowing the alphabet, Bessie has decided to attend school at the Fillet and Eggs Eater Academy. She has been making good progress with her studies and now knows the first _k_ English letters. Each morning, Bessie travels to school along a sidewalk consisting of _m_u...
2,200
false
true
false
true
false
false
false
false
false
false
7,230
78E
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon. The station is represented by a square _n_u2009×u2009_n_ divided into 1u2009×u20091 blocks. Each block is either a reactor o...
2,300
false
false
false
false
false
false
false
false
false
true
9,571
515E
Drazil is a monkey. He lives in a circular park. There are _n_ trees around the park. The distance between the _i_-th tree and (_i_u2009+u20091)-st trees is _d__i_, the distance between the _n_-th tree and the first tree is _d__n_. The height of the _i_-th tree is _h__i_. Drazil starts each day with the morning run. Th...
2,300
false
false
false
false
true
false
false
false
false
false
7,771
555D
Andrewid the Android is a galaxy-famous detective. Now he is busy with a top secret case, the details of which are not subject to disclosure. However, he needs help conducting one of the investigative experiment. There are _n_ pegs put on a plane, they are numbered from 1 to _n_, the coordinates of the _i_-th of them a...
2,500
true
false
true
false
false
false
false
true
false
false
7,612
1615B
You are given an array consisting of all integers from $$$xa0— the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains two integers $$$l$$$ and $$$r$$$ ($$$1 leq l leq r leq 2 cdot 10^5$$$)xa0— the description of the array. Note In the first test case, the array is $$$[1, 2]$$$. C...
1,300
true
true
false
false
false
false
false
false
false
false
2,563
1102E
Problem - 1102E - 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
false
false
false
false
false
false
false
false
true
false
5,189
388C
Fox Ciel is playing a card game with her friend Fox Jiro. There are _n_ piles of cards on the table. And there is a positive integer on each card. The players take turns and Ciel takes the first turn. In Ciel's turn she takes a card from the top of any non-empty pile, and in Jiro's turn he takes a card from the bottom ...
2,000
false
true
false
false
false
false
false
false
true
false
8,275
626C
Problem - 626C - Codeforces =============== xa0 ]( "23515") tower by stacking pieces lengthwise on top of each other. _n_ of the students use pieces made of two blocks and _m_ of the students use pieces made of three blocks. The students don’t want to use too many blocks, but they also want to be unique, s...
1,600
true
true
false
false
false
false
true
false
false
false
7,326
1255B
Hanh lives in a shared apartment. There are $$$n$$$ people (including Hanh) living there, each has a private fridge. $$$n$$$ fridges are secured by several steel chains. Each steel chain connects two different fridges and is protected by a digital lock. The owner of a fridge knows passcodes of all chains connected to i...
1,100
false
false
true
false
false
false
false
false
false
true
4,409
630N
Problem - 630N - Codeforces =============== xa0 ]( "Experimental Educational Round: VolBIT Formulas Blitz") — the coefficients of _ax_2u2009+u2009_bx_u2009+u2009_c_u2009=u20090 equation. Output In the first line output the greater of the equation roots, in the second line output the smaller one...
1,300
true
false
false
false
false
false
false
false
false
false
7,291
536D
Tavas lives in Kansas. Kansas has _n_ cities numbered from 1 to _n_ connected with _m_ bidirectional roads. We can travel from any city to any other city via these roads. Kansas is as strange as Tavas. So there may be a road between a city and itself or more than one road between two cities. Tavas invented a game and c...
2,900
false
false
false
true
false
false
false
false
false
false
7,690
1515A
Phoenix has collected $$$n$$$ pieces of gold, and he wants to weigh them together so he can feel rich. The $$$i$$$-th piece of gold has weight $$$w_i$$$. All weights are distinct. He will put his $$$n$$$ pieces of gold on a weight scale, one piece at a time. The scale has an unusual defect: if the total weight on it is...
800
true
true
false
false
false
true
false
false
false
false
3,091
1974A
Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $$$5 imes 3$$$, i.e., five rows and three columns. There are $$$x$$$ applications with an icon size of $$$1 imes 1$$$ cells; such an icon occupies only ...
800
true
true
false
false
false
false
false
false
false
false
449
1617C
Paprika loves permutations. She has an array $$$a_1, a_2, dots, a_n$$$. She wants to make the array a permutation of integers $$$1$$$ to $$$n$$$. In order to achieve this goal, she can perform operations on the array. In each operation she can choose two integers $$$i$$$ ($$$1 le i le n$$$) and $$$x$$$ ($$$x > 0$$$), t...
1,300
true
true
false
false
false
false
false
true
true
false
2,546
1657C
You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it. During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string. The prefix is considered good if one of...
1,200
false
true
true
false
false
false
false
false
false
false
2,343
1744E1
Problem - 1744E1 - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you -...
1,500
true
false
false
false
false
false
true
false
false
false
1,813
1421D
Lindsey Buckingham told Stevie Nicks $$$ to a certain cell given by the coordinates. She may go from a hexagon to any of its six neighbors you want, but there is a cost associated with each of them. The costs depend only on the direction in which you travel. Going from $$$(0, 0)$$$ to $$$(1, 1)$$$ will take the exact s...
1,900
true
true
true
false
false
true
true
false
false
false
3,571
121A
Problem - 121A - 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
false
false
true
false
false
false
false
false
false
false
9,396
1062E
The company $$$X$$$ has $$$n$$$ employees numbered from $$$1$$$ through $$$n$$$. Each employee $$$u$$$ has a direct boss $$$p_u$$$ ($$$1 le p_u le n$$$), except for the employee $$$1$$$ who has no boss. It is guaranteed, that values $$$p_i$$$ form a tree. Employee $$$u$$$ is said to be in charge of employee $$$v$$$ if ...
2,300
false
true
false
false
true
false
false
true
false
false
5,398
2027C
You're given an array $$$a$$$ initially containing $$$n$$$ integers. In one operation, you must do the following: Choose a position $$$i$$$ such that $$$1 < i le a$$$ and $$$a_i = a + 1 - i$$$, where $$$a$$$ is the current size of the array. Append $$$i - 1$$$ zeros onto the end of $$$a$$$. After performing this oper...
1,500
false
true
false
true
true
false
true
false
false
true
108
848A
From beginning till end, this message has been waiting to be conveyed. For a given unordered multiset of _n_ lowercase English letters ("multi" means that a letter may appear more than once), we treat all letters as strings of length 1, and repeat the following operation _n_u2009-u20091 times: Remove any two elements ...
1,600
false
false
false
false
false
true
false
false
false
false
6,358
1838B
You are given a permutation $$$p$$$ of size $$$n$$$. You want to minimize the number of subarrays of $$$p$$$ that are permutations. In order to do so, you must perform the following operation exactly once: Select integers $$$i$$$, $$$j$$$, where $$$1 le i, j le n$$$, then Swap $$$p_i$$$ and $$$p_j$$$. For example, if...
1,100
true
false
false
false
false
true
false
false
false
false
1,263
121E
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has an array consisting of _n_ numbers. He wants to perform _m_ operations of two types: add _...
2,400
false
false
false
false
true
false
false
false
false
false
9,392
1459B
Problem - 1459B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,300
true
false
false
true
false
false
false
false
false
false
3,387
42C
Problem - 42C - Codeforces =============== xa0 if the safe is secure, that is it's impossible to crack it. Otherwise, output should contain the sequence of operations (one operations per line) leading to unlocking the safe. You don't have to minimize the number of operations, but it should not exceed ...
2,200
false
false
false
false
false
true
true
false
false
false
9,777
1082F
Polycarp's phone book contains $$$n$$$ phone numbers, each of them is described by $$$s_i$$$ — the number itself and $$$m_i$$$ — the number of times Polycarp dials it in daily. Polycarp has just bought a brand new phone with an amazing speed dial feature! More precisely, $$$k$$$ buttons on it can have a number assigned...
2,800
false
false
false
true
false
false
false
false
false
false
5,310
508D
While dad was at work, a little girl Tanya decided to play with dad's password to his secret database. Dad's password is a string consisting of _n_u2009+u20092 characters. She has written all the possible _n_ three-letter continuous substrings of the password on pieces of paper, one for each piece of paper, and threw t...
2,500
false
false
false
false
false
false
false
false
false
true
7,808
382B
Problem - 382B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,000
true
false
false
false
false
false
false
true
false
false
8,302
25A
Problem - 25A - 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,300
false
false
false
false
false
false
true
false
false
false
9,873
2018F3
This is the hard 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. At...
3,100
true
true
false
true
false
false
false
false
false
false
155
1436E
Problem - 1436E - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
2,400
false
false
false
false
true
false
false
true
false
false
3,487
749A
Problem - 749A - 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
true
true
true
false
false
false
false
false
false
false
6,798
429E
Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following. Iahub wants to draw _n_ distinct segments [_l__i_,...
3,000
false
false
false
false
false
false
false
false
false
true
8,122
1883E
You are given an array of integers $$$a_1, a_2, ldots, a_n$$$. You need to make it non-decreasing with the minimum number of operations. In one operation, you do the following: Choose an index $$$1 leq i leq n$$$, Set $$$a_i = a_i cdot 2$$$. An array $$$b_1, b_2, ldots, b_n$$$ is non-decreasing if $$$b_i leq b_{i+1}$...
1,700
false
true
false
false
false
false
false
false
false
false
987
1814C
Suppose you have $$$n$$$ boxes. The $$$i$$$-th box contains infinitely many balls of color $$$i$$$. Sometimes you need to get a ball with some specific color; but you're too lazy to do it yourself. You have bought two robots to retrieve the balls for you. Now you have to program them. In order to program the robots, yo...
1,500
false
true
false
false
false
true
false
false
true
false
1,385
1182D
You have given tree consist of $$$n$$$ vertices. Select a vertex as root vertex that satisfies the condition below. For all vertices $$$v_{1}$$$ and $$$v_{2}$$$, if $$$distance$$$($$$root$$$, $$$v_{1}$$$) $$$= distance$$$($$$root$$$, $$$v_{2})$$$ then $$$degree$$$($$$v_{1}$$$) $$$= degree$$$($$$v_{2}$$$), where $$$deg...
2,400
false
false
true
true
false
true
false
false
false
false
4,805
1486C2
The only difference between the easy and the hard version is the limit to the number of queries. This is an interactive problem. There is an array $$$a$$$ of $$$n$$$ different numbers. In one query you can ask the position of the second maximum element in a subsegment $$$a[l..r]$$$. Find the position of the maximum ele...
1,900
false
false
false
false
false
false
false
true
false
false
3,250
1166D
Given a positive integer $$$m$$$, we say that a sequence $$$x_1, x_2, dots, x_n$$$ of positive integers is $$$m$$$-cute if for every index $$$i$$$ such that $$$2 le i le n$$$ it holds that $$$x_i = x_{i - 1} + x_{i - 2} + dots + x_1 + r_i$$$ for some positive integer $$$r_i$$$ satisfying $$$1 le r_i le m$$$. You will b...
2,200
true
true
false
false
false
false
true
true
false
false
4,886
701C
Sergei B., the young coach of Pokemons, has found the big house which consists of _n_ flats ordered in a row from left to right. It is possible to enter each flat from the street. It is possible to go out from each flat. Also, each flat is connected with the flat to the left and the flat to the right. Flat number 1 is ...
1,500
false
false
false
false
false
false
false
true
false
false
7,018
96B
Problem - 96B - 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,300
false
false
false
false
false
false
true
true
false
false
9,502
219D
The country Treeland consists of _n_ cities, some pairs of them are connected with unidirectional roads. Overall there are _n_u2009-u20091 roads in the country. We know that if we don't take the direction of the roads into consideration, we can get from any city to any other one. The council of the elders has recently ...
1,700
false
false
false
true
false
false
false
false
false
true
8,961
847G
Problem - 847G - 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...
900
false
false
true
false
false
false
false
false
false
false
6,365
1132A
A string is called bracket sequence if it does not contain any characters other than "(" and ")". A bracket sequence is called regular if it it is possible to obtain correct arithmetic expression by inserting characters "+" and "1" into this sequence. For example, "", "(())" and "()()" are regular bracket sequences; ")...
1,100
false
true
true
false
false
false
false
false
false
false
5,061
1277B
There are $$$n$$$ positive integers $$$a_1, a_2, dots, a_n$$$. For the one move you can choose any even value $$$c$$$ and divide by two all elements that equal $$$c$$$. For example, if $$$a=[6,8,12,6,3,12]$$$ and you choose $$$c=6$$$, and $$$a$$$ is transformed into $$$a=[3,8,12,3,3,12]$$$ after the move. You need to f...
1,200
false
true
false
false
false
false
false
false
false
false
4,308
669A
Problem - 669A - 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
true
false
false
false
false
false
false
false
false
false
7,148
1536F
Omkar and Akmar are playing a game on a circular board with $$$n$$$ ($$$2 leq n leq 10^6$$$) cells. The cells are numbered from $$$1$$$ to $$$n$$$ so that for each $$$i$$$ ($$$1 leq i leq n-1$$$) cell $$$i$$$ is adjacent to cell $$$i+1$$$ and cell $$$1$$$ is adjacent to cell $$$n$$$. Initially, each cell is empty. Omka...
2,600
true
false
false
false
false
true
false
false
false
false
2,963
1553I
Problem - 1553I - 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 - ...
3,400
true
false
false
true
false
false
false
false
false
false
2,867
1798B
Lottery "Three Sevens" was held for $$$m$$$ days. On day $$$i$$$, $$$n_i$$$ people with the numbers $$$a_{i, 1}, ldots, a_{i, n_i}$$$ participated in the lottery. It is known that in each of the $$$m$$$ days, only one winner was selected from the lottery participants. The lottery winner on day $$$i$$$ was not allowed t...
1,000
false
true
true
false
true
false
true
false
false
false
1,489
1594C
Theofanis has a string $$$s_1 s_2 dots s_n$$$ and a character $$$c$$$. He wants to make all characters of the string equal to $$$c$$$ using the minimum number of operations. In one operation he can choose a number $$$x$$$ ($$$1 le x le n$$$) and for every position $$$i$$$, where $$$i$$$ is not divisible by $$$x$$$, rep...
1,200
true
true
false
false
false
false
true
false
false
false
2,676
1420D
Ori and Sein have overcome many difficult challenges. They finally lit the Shrouded Lantern and found Gumon Seal, the key to the Forlorn Ruins. When they tried to open the door to the ruins... nothing happened. Ori was very surprised, but Sein gave the explanation quickly: clever Gumon decided to make an additional def...
1,800
false
false
false
false
true
false
false
false
true
false
3,576
793C
Igor the analyst fell asleep on the work and had a strange dream. In the dream his desk was crowded with computer mice, so he bought a mousetrap to catch them. The desk can be considered as an infinite plane, then the mousetrap is a rectangle which sides are parallel to the axes, and which opposite sides are located in...
2,300
true
false
true
false
false
false
false
false
true
false
6,605
2009D
Satyam is given $$$n$$$ distinct points on the 2D coordinate plane. It is guaranteed that $$$0 leq y_i leq 1$$$ for all given points $$$(x_i, y_i)$$$. How many different nondegenerate right triangles$$$^{ ext{∗}}$$$ can be formed from choosing three different points as its vertices? Two triangles $$$a$$$ and $$$b$$$ ar...
1,400
true
false
false
false
false
false
false
false
false
false
197
1244B
Nikolay lives in a two-storied house. There are $$$n$$$ rooms on each floor, arranged in a row and numbered from one from left to right. So each room can be represented by the number of the floor and the number of the room on this floor (room number is an integer between $$$1$$$ and $$$n$$$). If Nikolay is currently in...
1,000
false
false
true
false
false
false
true
false
false
false
4,480
1984B
A digit is large if it is between $$$5$$$ and $$$9$$$, inclusive. A positive integer is large if all of its digits are large. You are given an integer $$$x$$$. Can it be the sum of two large positive integers with the same number of digits? Input The first line contains a single integer $$$t$$$ ($$$1 leq t leq 10^4$$$)...
1,100
true
false
true
false
false
false
false
false
false
false
382
337D
Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains _n_ settlements numbered from 1 to _n_. Moving through the swamp is very difficult, so people tramped exactly _n_u2009-u20091 paths. Each of these paths connects some pair of settlements and is bidirectional. Moreover, it is...
2,000
false
false
false
true
false
false
false
false
false
false
8,484
1204E
Natasha's favourite numbers are $$$n$$$ and $$$1$$$, and Sasha's favourite numbers are $$$m$$$ and $$$-1$$$. One day Natasha and Sasha met and wrote down every possible array of length $$$n+m$$$ such that some $$$n$$$ of its elements are equal to $$$1$$$ and another $$$m$$$ elements are equal to $$$-1$$$. For each such...
2,300
true
false
false
true
false
false
false
false
false
false
4,670
1047A
Problem - 1047A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
true
false
false
false
false
false
false
false
false
false
5,457
762B
Due to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given the task of buying mouses, and you have to spend as little as possible. After all, the country is in crisis! The computers bought for the room were different. Some of them had only USB p...
1,400
false
true
true
false
false
false
false
false
true
false
6,742
1614E
Divan's new cottage is finally complete! However, after a thorough inspection, it turned out that the workers had installed the insulation incorrectly, and now the temperature in the house directly depends on the temperature outside. More precisely, if the temperature in the house is $$$P$$$ in the morning, and the str...
2,600
false
false
false
false
true
false
false
true
false
false
2,565
1285D
Problem - 1285D - 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
true
false
false
true
false
false
false
4,264
1969B
Let's define a cyclic shift of some string $$$s$$$ as a transformation from $$$s_1 s_2 dots s_{n-1} s_{n}$$$ into $$$s_{n} s_1 s_2 dots s_{n-1}$$$. In other words, you take one last character $$$s_n$$$ and place it before the first character while moving all other characters to the right. You are given a binary string ...
1,000
false
true
false
false
false
true
false
false
false
false
491
1873D
You are given a strip of paper $$$s$$$ that is $$$n$$$ cells long. Each cell is either black or white. In an operation you can take any $$$k$$$ consecutive cells and make them all white. Find the minimum number of operations needed to remove all black cells. Input The first line contains a single integer $$$t$$$ ($$$1 ...
800
false
true
true
false
false
false
false
false
false
false
1,041
643G
One social network developer recently suggested a new algorithm of choosing ads for users. There are _n_ slots which advertisers can buy. It is possible to buy a segment of consecutive slots at once. The more slots you own, the bigger are the chances your ad will be shown to users. Every time it is needed to choose ads...
3,200
false
false
false
false
true
false
false
false
false
false
7,238
672A
Problem - 672A - 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,135
1561C
In a certain video game, the player controls a hero characterized by a single integer value: power. The hero will have to beat monsters that are also characterized by a single integer value: armor. On the current level, the hero is facing $$$n$$$ caves. To pass the level, the hero must enter all the caves in some order...
1,300
false
true
false
false
false
false
false
true
true
false
2,822
1311B
You are given an array $$$a$$$ of length $$$n$$$. You are also given a set of distinct positions $$$p_1, p_2, dots, p_m$$$, where $$$1 le p_i < n$$$. The position $$$p_i$$$ means that you can swap elements $$$a[p_i]$$$ and $$$a[p_i + 1]$$$. You can apply this operation any number of times for each of the given position...
1,200
false
false
false
false
false
false
false
false
true
false
4,142
585F
Vasily has recently learned about the amazing properties of number π. In one of the articles it has been hypothesized that, whatever the sequence of numbers we have, in some position, this sequence is found among the digits of number π. Thus, if you take, for example, the epic novel "War and Peace" of famous Russian au...
3,200
false
false
true
true
false
false
false
false
false
false
7,500
2005B1
This is the easy version of the problem. The only differences between the two versions are the constraints on $$$m$$$ and $$$q$$$. In this version, $$$m=2$$$ and $$$q=1$$$. You can make hacks only if both versions of the problem are solved. Narek and Tsovak were busy preparing this round, so they have not managed to do...
1,000
true
true
false
false
false
false
false
false
true
false
223
1702D
Let $$$s$$$ be a string of lowercase Latin letters. Its price is the sum of the indices of letters (an integer between 1 and 26) that are included in it. For example, the price of the string abca is $$$1+2+3+1=7$$$. The string $$$w$$$ and the integer $$$p$$$ are given. Remove the minimal number of letters from $$$w$$$ ...
1,000
false
true
false
false
false
false
false
false
false
false
2,067
1887F
You had a sequence $$$a_1, a_2, ldots, a_n$$$ consisting of integers from $$$1$$$ to $$$n$$$, not necessarily distinct. For some unknown reason, you decided to calculate the following characteristic of the sequence: Let $$$r_i$$$ ($$$1 le i le n$$$) be the smallest $$$j ge i$$$ such that on the subsegment $$$a_i, a_{i...
3,400
false
false
false
false
false
true
false
false
false
false
967
94B
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something. The following statement caught his attention: "Among any six people there are either three pairwise acquainted people or three pairwise unacquainted people" Igor just coul...
1,300
true
false
true
false
false
false
false
false
false
true
9,509
1300B
Reminder: the . The number of students in the classes may be equal or different, by your choice. Every student has to be assigned to exactly one class. Among such partitions, you want to choose one in which the absolute difference between skill levels of the classes is minimized. What is the minimum possible absolute d...
1,000
false
true
true
false
false
false
false
false
true
false
4,195
793B
Woken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city where he lives, are closed due to road works. Moreover, Igor has some problems with the steering wheel,...
1,600
false
false
true
false
false
false
false
false
false
true
6,606
1735E
There are $$$n$$$ houses in your city arranged on an axis at points $$$h_1, h_2, ldots, h_n$$$. You want to build a new house for yourself and consider two options where to place it: points $$$p_1$$$ and $$$p_2$$$. As you like visiting friends, you have calculated in advance the distances from both options to all exist...
2,400
false
true
false
false
true
true
false
false
false
false
1,876
1004A
Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants. The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has $$$n$$$ hotels, where the $$$i$$$-th hotel is located in the city with ...
900
false
false
true
false
false
false
false
false
false
false
5,668
1633F
You are given a tree consisting of $$$n$$$ vertices (numbered from $$$1$$$ to $$$n$$$) and $$$n-1$$$ edges (numbered from $$$1$$$ to $$$n-1$$$). Initially, all vertices except vertex $$$1$$$ are inactive. You have to process queries of three types: $$$1$$$ $$$v$$$ — activate the vertex $$$v$$$. It is guaranteed that t...
2,800
false
false
false
false
true
false
false
false
false
false
2,447
1833E
# Round Dance Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes n people came to the festival and decided to dance a few round dances. There are at least 2 people in the round dance and each person has exactly two neighbors. If there are 2 people in the round ...
1,600
false
false
false
false
false
false
false
false
false
true
1,287
330A
Problem - 330A - 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
true
false
false
false
8,524
896B
This is an interactive problem. Refer to the Interaction section below for better understanding. Ithea and Chtholly want to play a game in order to determine who can use the kitchen tonight. Initially, Ithea puts _n_ clear sheets of paper in a line. They are numbered from 1 to _n_ from left to right. This game will go ...
2,000
false
true
false
false
false
true
false
true
false
false
6,164
7E
Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use. In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. Th...
2,600
false
false
true
true
false
false
false
false
false
false
9,956
1822C
Tema loves cinnabon rolls — buns with cinnabon and chocolate in the shape of a "snail". Cinnabon rolls come in different sizes and are square when viewed from above. The most delicious part of a roll is the chocolate, which is poured in a thin layer over the cinnabon roll in the form of a spiral and around the bun, as ...
800
true
false
false
false
false
false
false
false
false
false
1,349
1825B
LuoTianyi gave an array $$$b$$$ of $$$n cdot m$$$ integers. She asks you to construct a table $$$a$$$ of size $$$n imes m$$$, filled with these $$$n cdot m$$$ numbers, and each element of the array must be used exactly once. Also she asked you to maximize the following value: $$$sumlimits_{i=1}^{n}sumlimits_{j=1}^{m}l...
1,000
true
true
false
false
false
false
false
false
false
false
1,330
1462B
Polycarp has a string $$$s[1 dots n]$$$ of length $$$n$$$ consisting of decimal digits. Polycarp performs the following operation with the string $$$s$$$ no more than once (i.e. he can perform operation $$$0$$$ or $$$1$$$ time): Polycarp selects two numbers $$$i$$$ and $$$j$$$ ($$$1 leq i leq j leq n$$$) and removes c...
800
false
false
true
true
false
false
false
false
false
false
3,379
1095A
Problem - 1095A - 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
false
false
true
false
false
false
false
false
false
false
5,237
705B
Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a sequence of vertices, such that first one is connected with the second, second is connected with third and so on, while the last one is connected with the first one again. Cycle may consist of a single isolated vertex. Initially th...
1,100
true
false
false
false
false
false
false
false
false
false
7,000
1153F
Getting closer and closer to a mathematician, Serval becomes a university student on math major in Japari University. On the Calculus class, his teacher taught him how to calculate the expected length of a random subsegment of a given segment. Then he left a bonus problem as homework, with the award of a garage kit fro...
2,600
true
false
false
true
false
false
false
false
false
false
4,944
1264E
A football league has recently begun in Beautiful land. There are $$$n$$$ teams participating in the league. Let's enumerate them with integers from $$$1$$$ to $$$n$$$. There will be played exactly $$$frac{n(n-1)}{2}$$$ matches: each team will play against all other teams exactly once. In each match, there is always a ...
2,700
false
false
false
false
false
true
false
false
false
false
4,376
1817B
You are given a simple undirected graph with $$$n$$$ nodes and $$$m$$$ edges. Note that the graph is not necessarily connected. The nodes are labeled from $$$1$$$ to $$$n$$$. We define a graph to be a Fish Graph if it contains a simple cycle with a special node $$$u$$$ belonging to the cycle. Apart from the edges in th...
1,900
false
false
false
false
false
true
true
false
false
true
1,372
812C
On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some strange rules. It contains _n_ different items numbered from 1 to _n_. The _i_-th item has base cost _a__i_ Egyptian pounds. If Sagheer buys _k_ items with indices _x_1,u2009_x_2,u200...
1,500
false
false
false
false
false
false
false
true
true
false
6,514
980D
Problem - 980D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,100
true
false
false
true
false
false
false
false
false
false
5,803
1418G
Problem - 1418G - 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
false
false
false
false
true
false
false
false
false
false
3,588
756D
Julia is conducting an experiment in her lab. She placed several luminescent bacterial colonies in a horizontal testtube. Different types of bacteria can be distinguished by the color of light they emit. Julia marks types of bacteria with small Latin letters "a", ..., "z". The testtube is divided into _n_ consecutive r...
2,400
false
false
false
true
false
false
true
false
false
false
6,767
1433E
Problem - 1433E - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,300
true
false
false
false
false
false
false
false
false
false
3,495
995C
For a vector $$$vec{v} = (x, y)$$$, define $$$v = sqrt{x^2 + y^2}$$$. Allen had a bit too much to drink at the bar, which is at the origin. There are $$$n$$$ vectors $$$vec{v_1}, vec{v_2}, cdots, vec{v_n}$$$. Allen will make $$$n$$$ moves. As Allen's sense of direction is impaired, during the $$$i$$$-th move he will ei...
2,300
true
true
false
false
true
false
true
false
true
false
5,724
1361C
Johnny's younger sister Megan had a birthday recently. Her brother has bought her a box signed as "Your beautiful necklacexa0— do it yourself!". It contains many necklace parts and some magic glue. The necklace part is a chain connecting two pearls. Color of each pearl can be defined by a non-negative integer. The magi...
2,500
false
false
false
false
false
true
false
true
false
true
3,875
1428B
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$$...
1,200
false
false
true
false
false
false
false
false
false
true
3,524
1250I
The director of the famous dance show plans a tour. It is already decided that the tour will consist of up to $$$m$$$ concerts. There are $$$n$$$ dancers in the troupe. Each dancer is characterized by her awkwardness: the awkwardness of the $$$i$$$-th dancer is equal to $$$a_i$$$. The director likes diversity. For this...
3,100
false
true
false
false
false
false
true
true
false
false
4,447
1993F1
This is the easy version of the problem. The only difference is that in this version $$$k le n$$$. You can make hacks only if both versions of the problem are solved. Given a $$$w imes h$$$ rectangle on the $$$Oxy$$$ plane, with points $$$(0, 0)$$$ at the bottom-left and $$$(w, h)$$$ at the top-right of the rectangle....
2,400
true
false
false
false
false
true
true
false
false
false
307
760B
_n_ hobbits are planning to spend the night at Frodo's house. Frodo has _n_ beds standing in a row and _m_ pillows (_n_u2009≤u2009_m_). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as possible. Of course, it's not always possible to share pillows equally, but any hob...
1,500
false
true
false
false
false
false
false
true
false
false
6,750
900C
Problem - 900C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,700
true
false
false
false
true
false
true
false
false
false
6,144