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
1950G
Vladislav has a playlist consisting of $$$n$$$ songs, numbered from $$$1$$$ to $$$n$$$. Song $$$i$$$ has genre $$$g_i$$$ and writer $$$w_i$$$. He wants to make a playlist in such a way that every pair of adjacent songs either have the same writer or are from the same genre (or both). He calls such a playlist exciting. ...
1,900
false
false
true
true
false
false
false
false
false
true
575
417A
The finalists of the "Russian Code Cup" competition in 2214 will be the participants who win in one of the elimination rounds. The elimination rounds are divided into main and additional. Each of the main elimination rounds consists of _c_ problems, the winners of the round are the first _n_ people in the rating list. ...
1,500
true
false
true
true
false
false
false
false
false
false
8,157
1547B
A string $$$s$$$ of length $$$n$$$ ($$$1 le n le 26$$$) is called alphabetical if it can be obtained using the following algorithm: first, write an empty string to $$$s$$$ (i.e. perform the assignment $$$s$$$xa0:= ""); then perform the next step $$$n$$$ times; at the $$$i$$$-th step take $$$i$$$-th lowercase letter ...
800
false
true
true
false
false
false
false
false
false
false
2,912
1346I
Polycarp is developing a new version of an old video game "Pac-Man". Though he really enjoyed playing the original game, he didn't like some aspects of it, so he decided to alter the rules a bit. In Polycarp's version, you play as Pac-Man and you have to collect pellets scattered over the game world while avoiding dang...
2,900
false
false
false
true
false
false
false
false
false
false
3,971
605A
Problem - 605A - 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
false
true
false
false
false
true
false
false
false
false
7,426
1181C
Innokenty works at a flea market and sells some random stuff rare items. Recently he found an old rectangular blanket. It turned out that the blanket is split in $$$n cdot m$$$ colored pieces that form a rectangle with $$$n$$$ rows and $$$m$$$ columns. The colored pieces attracted Innokenty's attention so he immediatel...
1,900
false
false
true
true
false
false
true
false
false
false
4,812
1927D
You are given an array $$$a$$$ of $$$n$$$ integers, and $$$q$$$ queries. Each query is represented by two integers $$$l$$$ and $$$r$$$ ($$$1 le l le r le n$$$). Your task is to find, for each query, two indices $$$i$$$ and $$$j$$$ (or determine that they do not exist) such that: $$$l le i le r$$$; $$$l le j le r$$$; ...
1,300
false
true
false
true
true
false
true
true
false
false
727
380E
Problem - 380E - 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,306
1043B
Bajtek, known for his unusual gifts, recently got an integer array $$$x_0, x_1, ldots, x_{k-1}$$$. Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. After hours spent on searching for a new toy, Bajtek found on the arrays producer's website another array $$$a$$$ of l...
1,200
false
false
true
false
false
false
false
false
false
false
5,482
1805F2
This is the hard version of the problem. It differs from the easy one only in constraints on $$$n$$$. You can make hacks only if you lock both versions. Let $$$a_1, a_2, ldots, a_n$$$ be an array of non-negative integers. Let $$$F(a_1, a_2, ldots, a_n)$$$ be the sorted in the non-decreasing order array of $$$n - 1$$$ s...
3,100
true
true
false
false
false
false
false
false
true
false
1,443
521D
Vasya plays one very well-known and extremely popular MMORPG game. His game character has _k_ skill; currently the _i_-th of them equals to _a__i_. Also this game has a common rating table in which the participants are ranked according to the product of all the skills of a hero in the descending order. Vasya decided to...
2,800
false
true
false
false
false
false
false
false
false
false
7,752
45C
There are _n_ people taking dancing lessons. Every person is characterized by his/her dancing skill _a__i_. At the beginning of the lesson they line up from left to right. While there is at least one couple of a boy and a girl in the line, the following process is repeated: the boy and girl who stand next to each other...
1,900
false
false
false
false
true
false
false
false
false
false
9,757
1553F
Problem - 1553F - 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,300
true
false
false
false
true
false
false
false
false
false
2,870
1426A
Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is $$$n$$$. There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains $$$2$$$ apartments, every other floor contains $$$x$$$ apartments each. Apartments are numbered startin...
800
true
false
true
false
false
false
false
false
false
false
3,539
254C
String _x_ is an anagram of string _y_, if we can rearrange the letters in string _x_ and get exact string _y_. For example, strings "DOG" and "GOD" are anagrams, so are strings "BABA" and "AABB", but strings "ABBAC" and "CAABA" are not. You are given two strings _s_ and _t_ of the same length, consisting of uppercase ...
1,800
false
true
false
false
false
false
false
false
false
false
8,817
1372B
In Omkar's last class of math, he learned about the least common multiple, or $$$LCM$$$. $$$LCM(a, b)$$$ is the smallest positive integer $$$x$$$ which is divisible by both $$$a$$$ and $$$b$$$. Omkar, having a laudably curious mind, immediately thought of a problem involving the $$$LCM$$$ operation: given an integer $$...
1,300
true
true
false
false
false
false
false
false
false
false
3,806
116B
Once upon a time there were several little pigs and several wolves on a two-dimensional grid of size _n_u2009Γ—u2009_m_. Each cell in this grid was either empty, containing one little pig, or containing one wolf. A little pig and a wolf are adjacent if the cells that they are located at share a side. The little pigs are...
1,100
false
true
true
false
false
false
false
false
false
false
9,422
899C
Problem - 899C - 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,300
true
false
false
false
false
true
false
false
false
true
6,150
1418A
You are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft $$$k$$$ torches. One torch can be crafted using one stick and one coal. Hopefully, you've met a very handsome wandering trader who has two trade offers: exchange $$$1$$$ stick for $$$x$$$ sticks (you lose $$$1$$$ stic...
1,000
true
false
false
false
false
false
false
false
false
false
3,594
1824B2
This is the hard version of the problem. The only difference is that in this version $$$kle n$$$. You can make hacks only if both versions of the problem are solved. Chtholly and the floating islands. LuoTianyi now lives in a world with $$$n$$$ floating islands. The floating islands are connected by $$$n-1$$$ undirect...
2,300
true
false
false
false
false
false
false
false
false
false
1,335
765F
Artsem is on vacation and wants to buy souvenirs for his two teammates. There are _n_ souvenir shops along the street. In _i_-th shop Artsem can buy one souvenir for _a__i_ dollars, and he cannot buy more than one souvenir in one shop. He doesn't want to introduce envy in his team, so he wants to buy two souvenirs with...
3,100
false
false
false
false
true
false
false
false
false
false
6,725
978G
Petya studies at university. The current academic year finishes with $$$n$$$ special days. Petya needs to pass $$$m$$$ exams in those special days. The special days in this problem are numbered from $$$1$$$ to $$$n$$$. There are three values about each exam: $$$s_i$$$ β€” the day, when questions for the $$$i$$$-th exam ...
1,700
false
true
true
false
false
false
false
false
true
false
5,812
1239A
Problem - 1239A - 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
4,496
1082A
Vasya is reading a e-book. The file of the book consists of $$$n$$$ pages, numbered from $$$1$$$ to $$$n$$$. The screen is currently displaying the contents of page $$$x$$$, and Vasya wants to read the page $$$y$$$. There are two buttons on the book which allow Vasya to scroll $$$d$$$ pages forwards or backwards (but h...
1,200
true
false
true
false
false
false
false
false
false
false
5,315
1721C
You are given an array $$$a_1, a_2, dots, a_n$$$, which is sorted in non-descending order. You decided to perform the following steps to create array $$$b_1, b_2, dots, b_n$$$: 1. Create an array $$$d$$$ consisting of $$$n$$$ arbitrary non-negative integers. 2. Set $$$b_i = a_i + d_i$$$ for each $$$b_i$$$. 3. Sort the ...
1,400
false
true
false
false
false
false
false
true
false
false
1,957
734D
Anton likes to play chess. Also, he likes to do programming. That is why he decided to write the program that plays chess. However, he finds the game on 8 to 8 board to too simple, he uses an infinite one instead. The first task he faced is to check whether the king is in check. Anton doesn't know how to implement this...
1,700
false
false
true
false
false
false
false
false
false
false
6,855
31D
Bob has a rectangular chocolate bar of the size _W_u2009Γ—u2009_H_. He introduced a cartesian coordinate system so that the point (0,u20090) corresponds to the lower-left corner of the bar, and the point (_W_,u2009_H_) corresponds to the upper-right corner. Bob decided to split the bar into pieces by breaking it. Each b...
2,000
false
false
true
false
false
false
false
false
false
false
9,840
1676D
Timur's grandfather gifted him a chessboard to practice his chess skills. This chessboard is a grid $$$a$$$ with $$$n$$$ rows and $$$m$$$ columns with each cell having a non-negative integer written on it. Timur's challenge is to place a bishop on the board such that the sum of all cells attacked by the bishop is maxim...
1,000
false
true
true
false
false
false
true
false
false
false
2,212
2022B
Karel is a salesman in a car dealership. The dealership has $$$n$$$ different models of cars. There are $$$a_i$$$ cars of the $$$i$$$-th model. Karel is an excellent salesperson and can convince customers to buy up to $$$x$$$ cars (of Karel's choice), as long as the cars are from different models. Determine the minimum...
1,300
true
true
false
false
false
false
false
true
false
false
137
1054D
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 leq x leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that no o...
1,900
false
true
true
false
false
false
false
false
false
false
5,444
1881D
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers. You can perform the following operation on it: 1. Choose a pair of elements $$$a_i$$$ and $$$a_j$$$ ($$$1 le i, j le n$$$ and $$$i eq j$$$); 2. Choose one of the divisors of the integer $$$a_i$$$, i.e., an integer $$$x$$$ such that $$$a_i bmod x =...
1,300
true
false
false
false
false
false
false
false
false
false
1,001
1903D1
This is the easy version of the problem. The only difference between the two versions is the constraint on $$$n$$$ and $$$q$$$, the memory and time limits. You can make hacks only if all versions of the problem are solved. Theofanis really likes to play with the bits of numbers. He has an array $$$a$$$ of size $$$n$$$ ...
1,700
false
true
false
false
false
false
true
true
false
false
894
380D
The cinema theater hall in Sereja's city is _n_ seats lined up in front of one large screen. There are slots for personal possessions to the left and to the right of each seat. Any two adjacent seats have exactly one shared slot. The figure below shows the arrangement of seats and slots for _n_u2009=u20094. Today it's ...
2,500
true
false
false
false
false
false
false
false
false
false
8,307
1776B
Vittorio is playing with his new LEGO Duplo bricks. All the bricks have the shape of a square cuboid with a $$$2 imes 2$$$ square base and a height of $$$1$$$. They can be arranged in the 3D space to build structures, provided that the following rules are met: 1. No two bricks can intersect, but they can touch on thei...
2,200
false
false
false
true
false
false
false
false
false
false
1,627
1832F
Polycarp plays a computer game in a post-apocalyptic setting. The zombies have taken over the world, and Polycarp with a small team of survivors is defending against hordes trying to invade their base. The zombies are invading for $$$x$$$ minutes starting from minute $$$0$$$. There are $$$n$$$ entrances to the base, an...
3,200
false
false
false
true
false
false
false
true
false
false
1,292
1957E
You are given an integer $$$n$$$. The function $$$C(i,k)$$$ represents the number of distinct ways you can select $$$k$$$ distinct numbers from the set {$$$1, 2, ldots, i$$$} and arrange them in a circle$$$^dagger$$$. Find the value of $$$$$$ sumlimits_{i=1}^n sumlimits_{j=1}^i left( C(i,j) bmod j ight). $$$$$$ Here, ...
2,400
true
false
false
true
false
false
true
false
false
false
529
680B
There are _n_ cities in Bearland, numbered 1 through _n_. Cities are arranged in one long row. The distance between cities _i_ and _j_ is equal to _i_u2009-u2009_j_. Limak is a police officer. He lives in a city _a_. His job is to catch criminals. It's hard because he doesn't know in which cities criminals are. Though,...
1,000
false
false
true
false
false
true
false
false
false
false
7,104
1481A
You were dreaming that you are traveling to a planet named Planetforces on your personal spaceship. Unfortunately, its piloting system was corrupted and now you need to fix it in order to reach Planetforces. Space can be represented as the $$$XY$$$ plane. You are starting at point $$$(0, 0)$$$, and Planetforces is loca...
800
false
true
false
false
false
false
false
false
false
false
3,273
652A
The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height _h_1 cm from the ground. On the height _h_2 cm (_h_2u2009>u2009_h_1) on the same tree hung an apple and the caterpillar was crawling to the apple. Gabriel is interested whe...
1,400
true
false
true
false
false
false
false
false
false
false
7,210
1349D
Slime and his $$$n$$$ friends are at a party. Slime has designed a game for his friends to play. At the beginning of the game, the $$$i$$$-th player has $$$a_i$$$ biscuits. At each second, Slime will choose a biscuit randomly uniformly among all $$$a_1 + a_2 + ldots + a_n$$$ biscuits, and the owner of this biscuit will...
3,200
true
false
false
false
false
false
false
false
false
false
3,961
1093D
You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges. You have to write a number on each vertex of the graph. Each number should be $$$1$$$, $$$2$$$ or $$$3$$$. The graph becomes beautiful if for each edge the sum of numbers on vertices connected by this edge is odd. Calculate t...
1,700
false
false
false
false
false
false
false
false
false
true
5,241
1113A
Sasha is a very happy guy, that's why he is always on the move. There are $$$n$$$ cities in the country where Sasha lives. They are all located on one straight line, and for convenience, they are numbered from $$$1$$$ to $$$n$$$ in increasing order. The distance between any two adjacent cities is equal to $$$1$$$ kilom...
900
true
true
false
true
false
false
false
false
false
false
5,136
1216C
There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume that the bottom left corner of the table has coordinates $$$(0, 0)$$$, and coordinate axes are left and bottom sides of the table, then th...
1,700
true
false
false
false
false
false
false
false
false
false
4,595
27A
Problem - 27A - 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
true
false
9,863
1237E
Recall that a binary search tree is a rooted binary tree, whose nodes each store a key and each have at most two distinguished subtrees, left and right. The key in each node must be greater than any key stored in the left subtree, and less than any key stored in the right subtree. The depth of a vertex is the number of...
2,400
true
false
false
true
false
false
false
false
false
false
4,507
988C
You are given $$$k$$$ sequences of integers. The length of the $$$i$$$-th sequence equals to $$$n_i$$$. You have to choose exactly two sequences $$$i$$$ and $$$j$$$ ($$$i e j$$$) such that you can remove exactly one element in each of them in such a way that the sum of the changed sequence $$$i$$$ (its length will be ...
1,400
false
false
true
false
false
false
false
false
true
false
5,761
1511B
You are given three integers $$$a$$$, $$$b$$$ and $$$c$$$. Find two positive integers $$$x$$$ and $$$y$$$ ($$$x > 0$$$, $$$y > 0$$$) such that: the decimal representation of $$$x$$$ without leading zeroes consists of $$$a$$$ digits; the decimal representation of $$$y$$$ without leading zeroes consists of $$$b$$$ digi...
1,100
true
false
false
false
false
true
false
false
false
false
3,115
662E
Consider a regular Codeforces round consisting of three problems that uses dynamic scoring. You are given an almost final scoreboard. For each participant (including yourself), the time of the accepted submission for each of the problems is given. Also, for each solution you already know whether you are able to hack it...
3,100
false
true
false
true
false
false
true
false
false
false
7,164
1729F
Given the string $$$s$$$ of decimal digits (0-9) of length $$$n$$$. A substring is a sequence of consecutive characters of a string. The substring of this string is defined by a pair of indexes β€” with its left and right ends. So, each pair of indexes ($$$l, r$$$), where $$$1 le l le r le n$$$, corresponds to a substrin...
1,900
true
false
false
false
false
false
false
false
false
false
1,913
1393B
This year in Equestria was a year of plenty, so Applejack has decided to build some new apple storages. According to the advice of the farm designers, she chose to build two storages with non-zero area: one in the shape of a square and another one in the shape of a rectangle (which possibly can be a square as well). Ap...
1,400
false
true
true
false
true
true
false
false
false
false
3,706
437C
On Children's Day, the child got a toy from Delayyy as a present. However, the child is so naughty that he can't wait to destroy the toy. The toy consists of _n_ parts and _m_ ropes. Each rope links two parts, but every pair of parts is linked by at most one rope. To split the toy, the child must remove all its parts. ...
1,400
false
true
false
false
false
false
false
false
true
true
8,089
1468J
There are $$$n$$$ cities and $$$m$$$ bidirectional roads in Berland. The $$$i$$$-th road connects the cities $$$x_i$$$ and $$$y_i$$$, and has the speed limit $$$s_i$$$. The road network allows everyone to get from any city to any other city. The Berland Transport Ministry is planning a road reform. First of all, mainta...
1,800
false
true
false
false
false
false
false
false
false
true
3,343
1809G
Consider a tournament with $$$n$$$ participants. The rating of the $$$i$$$-th participant is $$$a_i$$$. The tournament will be organized as follows. First of all, organizers will assign each participant an index from $$$1$$$ to $$$n$$$. All indices will be unique. Let $$$p_i$$$ be the participant who gets the index $$$...
2,800
true
false
false
true
false
false
false
false
false
false
1,414
1209E2
This is a harder version of the problem. The difference is only in constraints. You are given a rectangular $$$n imes m$$$ matrix $$$a$$$. In one move you can choose any column and cyclically shift elements in this column. You can perform this operation as many times as you want (possibly zero). You can perform this o...
2,500
false
true
false
true
false
false
false
false
true
false
4,641
414A
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of _n_ distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he rem...
1,500
false
false
false
false
false
true
false
false
false
false
8,169
100H
Do you know the game Battleship? If no, look into Wikipedia article You are given the positions of ships on a 10u2009Γ—u200910 board for playing Battleship. According to the rules, the board should contain the following ships: one of size 4 (4u2009Γ—u20091 or 1u2009Γ—u20094 rectangle), two of size 3 (3u2009Γ—u20091 or 1u...
2,100
false
false
true
false
false
false
false
false
false
false
9,482
920F
Problem - 920F - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,000
false
false
false
false
true
false
true
false
false
false
6,045
768G
Given a rooted tree with _n_ nodes. The Night King removes exactly one node from the tree and all the edges associated with it. Doing this splits the tree and forms a forest. The node which is removed is not a part of the forest. The root of a tree in the forest is the node in that tree which does not have a parent. We...
3,300
false
false
false
false
true
false
false
true
false
false
6,707
1774H
Ecrade bought a deck of cards numbered from $$$1$$$ to $$$n$$$. Let the value of a permutation $$$a$$$ of length $$$n$$$ be $$$minlimits_{i = 1}^{n - k + 1} sumlimits_{j = i}^{i + k - 1}a_j$$$. Ecrade wants to find the most valuable one among all permutations of the cards. However, it seems a little difficult, so pleas...
3,500
false
false
false
false
false
true
false
false
false
false
1,636
1557A
Ezzat has an array of $$$n$$$ integers (maybe negative). He wants to split it into two non-empty subsequences $$$a$$$ and $$$b$$$, such that every element from the array belongs to exactly one subsequence, and the value of $$$f(a) + f(b)$$$ is the maximum possible value, where $$$f(x)$$$ is the average of the subsequen...
800
true
false
false
false
false
false
true
false
true
false
2,847
26B
Problem - 26B - 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,400
false
true
false
false
false
false
false
false
false
false
9,867
735A
On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length _n_ such that some cells of this line are empty and some contain obstacles. Then, he places his grasshopper to one of the empty cells and a small insect in another empty cell. The gr...
800
false
false
true
false
false
false
false
false
false
false
6,852
1837B
Problem - 1837B - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
900
false
true
false
false
false
false
false
false
false
false
1,269
989E
The cool breeze blows gently, the flowing water ripples steadily."Flowing and passing like this, the water isn't gone ultimately; Waxing and waning like that, the moon doesn't shrink or grow eventually." "Everything is transient in a way and perennial in another." Kanno doesn't seem to make much sense out of Mino's iso...
2,700
false
false
false
true
false
false
false
false
false
false
5,753
1774F2
This is the hard version of the problem. The only difference between the two versions is the constraint on $$$n$$$ and $$$x$$$. You can make hacks only if both versions of the problem are solved. Little09 has been interested in magic for a long time, and it's so lucky that he meets a magician! The magician will perform...
2,700
false
false
true
false
true
false
true
true
false
false
1,638
538F
Andrew skipped lessons on the subject 'Algorithms and Data Structures' for the entire term. When he came to the final test, the teacher decided to give him a difficult task as a punishment. The teacher gave Andrew an array of _n_ numbers _a_1, ..., _a__n_. After that he asked Andrew for each _k_ from 1 to _n_u2009-u200...
2,200
true
false
false
false
true
false
true
false
true
false
7,683
1585G
Alice and Bob are two poachers who cut trees in a forest. A forest is a set of zero or more trees. A tree is a connected graph without cycles. A rooted tree has a special vertex called the root. The parent of a node $$$v$$$ is the next vertex on the shortest path from $$$v$$$ to the root. Children of vertex $$$v$$$ are...
2,500
false
false
false
true
false
false
false
false
false
true
2,696
1876A
Pak Chanek is the chief of a village named Khuntien. On one night filled with lights, Pak Chanek has a sudden and important announcement that needs to be notified to all of the $$$n$$$ residents in Khuntien. First, Pak Chanek shares the announcement directly to one or more residents with a cost of $$$p$$$ for each pers...
1,000
false
true
false
false
false
false
false
false
true
false
1,026
486D
As you know, an undirected connected graph with _n_ nodes and _n_u2009-u20091 edges is called a tree. You are given an integer _d_ and a tree consisting of _n_ nodes. Each node _i_ has a value _a__i_ associated with it. We call a set _S_ of tree nodes valid if following conditions are satisfied: 1. _S_ is non-empty. 2....
2,100
true
false
false
true
false
false
false
false
false
false
7,892
625C
People do many crazy things to stand out in a crowd. Some of them dance, some learn by heart rules of Russian language, some try to become an outstanding competitive programmers, while others collect funny math objects. Alis is among these collectors. Right now she wants to get one of _k_-special tables. In case you fo...
1,300
false
false
true
false
false
true
false
false
false
false
7,331
1093G
You are given an array $$$a$$$ of $$$n$$$ points in $$$k$$$-dimensional space. Let the distance between two points $$$a_x$$$ and $$$a_y$$$ be $$$sum limits_{i = 1}^{k} a_{x, i} - a_{y, i}$$$ (it is also known as Manhattan distance). You have to process $$$q$$$ queries of the following two types: $$$1$$$ $$$i$$$ $$$b_1...
2,300
false
false
false
false
true
false
false
false
false
false
5,238
610C
The semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how does the professor look like, at least. Danil was very bored on this lesson until the teacher gave the group a simple task: find 4 vectors in 4-dimensional space, such that every coordinate of every vec...
1,800
false
false
false
false
false
true
false
false
false
false
7,404
264E
Squirrel Liss loves nuts. Liss asks you to plant some nut trees. There are _n_ positions (numbered 1 to _n_ from west to east) to plant a tree along a street. Trees grow one meter per month. At the beginning of each month you should process one query. The query is one of the following types: 1. Plant a tree of height _...
3,000
false
false
false
true
true
false
false
false
false
false
8,774
1207B
You are given two matrices $$$A$$$ and $$$B$$$. Each matrix contains exactly $$$n$$$ rows and $$$m$$$ columns. Each element of $$$A$$$ is either $$$0$$$ or $$$1$$$; each element of $$$B$$$ is initially $$$0$$$. You may perform some operations with matrix $$$B$$$. During each operation, you choose any submatrix of $$$B$...
1,200
false
true
true
false
false
true
false
false
false
false
4,660
981D
Mr Keks is a typical white-collar in Byteland. He has a bookshelf in his office with some books on it, each book has an integer positive price. Mr Keks defines the value of a shelf as the sum of books prices on it. Miraculously, Mr Keks was promoted and now he is moving into a new office. He learned that in the new off...
1,900
false
true
false
true
false
false
false
false
false
false
5,797
461C
Appleman has a very big sheet of paper. This sheet has a form of rectangle with dimensions 1u2009Γ—u2009_n_. Your task is help Appleman with folding of such a sheet. Actually, you need to perform _q_ queries. Each query will have one of the following types: 1. Fold the sheet of paper at position _p__i_. After this query...
2,200
false
false
true
false
true
false
false
false
false
false
7,994
1118D2
The only difference between easy and hard versions is the constraints. Polycarp has to write a coursework. The coursework consists of $$$m$$$ pages. Polycarp also has $$$n$$$ cups of coffee. The coffee in the $$$i$$$-th cup Polycarp has $$$a_i$$$ caffeine in it. Polycarp can drink some cups of coffee (each one no more ...
1,700
false
true
false
false
false
false
false
true
false
false
5,098
678B
Problem - 678B - Codeforces =============== xa0 ]( "Educational Codeforces Round 13") β€” the year of the calendar. Output Print the only integer _y_' β€” the next year after _y_ when the calendar will be the same. Note that you should find the first year after _y_ with the same calendar. Examples Input 2016 ...
1,600
false
false
true
false
false
false
false
false
false
false
7,115
987B
Year 2118. Androids are in mass production for decades now, and they do all the work for humans. But androids have to go to school to be able to solve creative tasks. Just like humans before. It turns out that high school struggles are not gone. If someone is not like others, he is bullied. Vasya-8800 is an economy-cla...
1,100
true
false
false
false
false
false
false
false
false
false
5,765
1020A
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room. The bui...
1,000
true
false
false
false
false
false
false
false
false
false
5,592
304B
Problem - 304B - 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,300
false
false
true
false
false
false
true
false
false
false
8,617
1669C
Given an array $$$a=[a_1,a_2,dots,a_n]$$$ of $$$n$$$ positive integers, you can do operations of two types on it: 1. Add $$$1$$$ to every element with an odd index. In other words change the array as follows: $$$a_1 := a_1 +1, a_3 := a_3 + 1, a_5 := a_5+1, dots$$$. 2. Add $$$1$$$ to every element with an even index. In...
800
true
true
true
false
false
false
false
false
false
false
2,263
1858A
Anna and Katie ended up in a secret laboratory. There are $$$a+b+c$$$ buttons in the laboratory. It turned out that $$$a$$$ buttons can only be pressed by Anna, $$$b$$$ buttons can only be pressed by Katie, and $$$c$$$ buttons can be pressed by either of them. Anna and Katie decided to play a game, taking turns pressin...
800
true
true
false
false
false
false
false
false
false
false
1,137
1841B
The array $$$[a_1, a_2, dots, a_k]$$$ is called beautiful if it is possible to remove several (maybe zero) elements from the beginning of the array and insert all these elements to the back of the array in the same order in such a way that the resulting array is sorted in non-descending order. In other words, the array...
1,000
false
false
true
false
false
false
false
false
false
false
1,244
1364D
# Ehab’s Last Corollary Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes Given a connected undirected graph with n vertices and an integer k, you have to either: β€’ either find an independent set that has exactly d k > 2 e vertices. β€’ or find a simple cycle o...
2,100
false
true
true
false
false
true
false
false
false
true
3,859
362A
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and 2 squares to the left, 2 squares backward and 2 to the right and 2 squares backward and 2 to the le...
1,500
true
true
false
false
false
false
false
false
false
false
8,387
912E
Problem - 912E - 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,400
true
false
false
false
false
false
false
true
false
false
6,092
498E
Problem - 498E - 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,700
false
false
false
true
false
false
false
false
false
false
7,840
1176C
You are given an array $$$a$$$ consisting of $$$n$$$ integers. Each $$$a_i$$$ is one of the six following numbers: $$$4, 8, 15, 16, 23, 42$$$. Your task is to remove the minimum number of elements to make this array good. An array of length $$$k$$$ is called good if $$$k$$$ is divisible by $$$6$$$ and it is possible to...
1,300
false
true
true
true
false
false
false
false
false
false
4,836
478E
Problem - 478E - 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,900
false
false
false
false
false
false
true
false
true
false
7,917
1064B
Colossal!xa0β€” exclaimed Hawk-nose.xa0β€” A programmer! That's exactly what we are looking for. Arkadi and Boris Strugatsky. Monday starts on Saturday Reading the book "Equations of Mathematical Magic" Roman Oira-Oira and Cristobal Junta found an interesting equation: $$$a - (a oplus x) - x = 0$$$ for some given $$$a$$$, ...
1,200
true
false
false
false
false
false
false
false
false
false
5,389
177D2
The Smart Beaver from ABBYY invented a new message encryption method and now wants to check its performance. Checking it manually is long and tiresome, so he decided to ask the ABBYY Cup contestants for help. A message is a sequence of _n_ integers _a_1,u2009_a_2,u2009...,u2009_a__n_. Encryption uses a key which is a s...
1,500
false
false
false
false
true
false
false
false
false
false
9,147
12A
There is a very secret base in Potatoland where potato mash is made according to a special recipe. The neighbours from Porridgia decided to seize this recipe and to sell it to Pilauland. For this mission they have been preparing special agent Pearlo for many years. When, finally, Pearlo learned all secrets of espionage...
800
false
false
true
false
false
false
false
false
false
false
9,935
1073A
You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. A substring of string $$$s$$$ is a continuous segment of letters from $$$s$$$. For example, "defor" is a substring of "codeforces" and "fors" is not. The length of the substring is the number of letters in it. Let's call some string of lengt...
1,000
false
false
true
false
false
false
false
false
false
false
5,353
1538G
Polycarp has $$$x$$$ of red and $$$y$$$ of blue candies. Using them, he wants to make gift sets. Each gift set contains either $$$a$$$ red candies and $$$b$$$ blue candies, or $$$a$$$ blue candies and $$$b$$$ red candies. Any candy can belong to at most one gift set. Help Polycarp to find the largest number of gift set...
2,100
true
true
false
false
false
false
false
true
false
false
2,949
1919C
You are given an array $$$a$$$ of size $$$n$$$. You will do the following process to calculate your penalty: 1. Split array $$$a$$$ into two (possibly empty) subsequences$$$^dagger$$$ $$$s$$$ and $$$t$$$ such that every element of $$$a$$$ is either in $$$s$$$ or $$$t^ddagger$$$. 2. For an array $$$b$$$ of size $$$m$$$,...
1,400
false
true
false
true
true
false
false
false
false
false
779
1599I
Problem - 1599I - 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
false
false
true
2,656
1201E1
This problem only differs from the next problem in constraints. This is an interactive problem. Alice and Bob are playing a game on the chessboard of size $$$n imes m$$$ where $$$n$$$ and $$$m$$$ are even. The rows are numbered from $$$1$$$ to $$$n$$$ and the columns are numbered from $$$1$$$ to $$$m$$$. There are two...
2,900
false
false
false
false
false
false
false
false
false
true
4,691
1239E
Kolya has a turtle and a field of size $$$2 imes n$$$. The field rows are numbered from $$$1$$$ to $$$2$$$ from top to bottom, while the columns are numbered from $$$1$$$ to $$$n$$$ from left to right. Suppose in each cell of the field there is a lettuce leaf. The energy value of lettuce leaf in row $$$i$$$ and column...
3,100
false
false
true
true
false
false
false
false
false
false
4,492
246B
Problem - 246B - 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,300
true
true
false
false
false
false
false
false
false
false
8,847