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
2031C
Penchick loves two things: square numbers and Hong Kong-style BBQ buns! For his birthday, Kohane wants to combine them with a gift: $$$n$$$ BBQ buns arranged from left to right. There are $$$10^6$$$ available fillings of BBQ buns, numbered from $$$1$$$ to $$$10^6$$$. To ensure that Penchick would love this gift, Kohane...
1,300
true
false
false
false
false
true
false
false
false
false
78
277C
Two players play the following game. Initially, the players have a knife and a rectangular sheet of paper, divided into equal square grid cells of unit size. The players make moves in turn, the player who can't make a move loses. In one move, a player can take the knife and cut the paper along any segment of the grid l...
2,400
false
false
true
false
false
false
false
false
false
false
8,725
1330B
The sequence of $$$m$$$ integers is called the permutation if it contains all integers from $$$1$$$ to $$$m$$$ exactly once. The number $$$m$$$ is called the length of the permutation. Dreamoon has two permutations $$$p_1$$$ and $$$p_2$$$ of non-zero lengths $$$l_1$$$ and $$$l_2$$$. Now Dreamoon concatenates these two ...
1,400
true
false
true
false
false
false
false
false
false
false
4,059
1561A
You have a permutation: an array $$$a = [a_1, a_2, ldots, a_n]$$$ of distinct integers from $$$1$$$ to $$$n$$$. The length of the permutation $$$n$$$ is odd. Consider the following algorithm of sorting the permutation in increasing order. A helper procedure of the algorithm, $$$f(i)$$$, takes a single argument $$$i$$$ ...
800
false
false
true
false
false
false
true
false
true
false
2,823
1461D
Mike received an array $$$a$$$ of length $$$n$$$ as a birthday present and decided to test how pretty it is. An array would pass the $$$i$$$-th prettiness test if there is a way to get an array with a sum of elements totaling $$$s_i$$$, using some number (possibly zero) of slicing operations. An array slicing operation...
1,600
false
false
true
false
true
false
true
true
true
false
3,383
1681C
You are given two arrays $$$a$$$ and $$$b$$$, both consisting of $$$n$$$ integers. In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$1 le i, j le n$$$; $$$i eq j$$$) and swap $$$a_i$$$ with $$$a_j$$$ and $$$b_i$$$ with $$$b_j$$$. You have to perform the swap in both arrays. You are allowed to perform at ...
1,200
false
false
true
false
false
false
false
false
true
false
2,183
1971H
Bob has a grid with $$$3$$$ rows and $$$n$$$ columns, each of which contains either $$$a_i$$$ or $$$-a_i$$$ for some integer $$$1 leq i leq n$$$. For example, one possible grid for $$$n=4$$$ is shown below: $$$$$$begin{bmatrix} a_1 & -a_2 & -a_3 & -a_2 -a_4 & a_4 & -a_1 & -a_3 a_1 & a_2 & -a_2 & a_4 end{bmatrix}$$$$$...
2,100
false
false
false
false
false
false
false
false
false
true
458
169B
Problem - 169B - 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
true
false
false
false
false
false
false
false
false
9,187
1686B
For an array $$$[b_1, b_2, ldots, b_m]$$$ define its number of inversions as the number of pairs $$$(i, j)$$$ of integers such that $$$1 le i < j le m$$$ and $$$b_i>b_j$$$. Let's call array $$$b$$$ odd if its number of inversions is odd. For example, array $$$[4, 2, 7]$$$ is odd, as its number of inversions is $$$1$$$,...
800
false
true
false
true
false
false
false
false
false
false
2,158
1585E
Petya has a rooted tree with an integer written on each vertex. The vertex $$$1$$$ is the root. You are to answer some questions about the tree. 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$...
2,400
false
false
false
false
true
false
false
false
false
false
2,698
441E
Problem - 441E - 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
true
false
false
false
false
false
false
8,071
1815A
To thank Ian, Mary gifted an array $$$a$$$ of length $$$n$$$ to Ian. To make himself look smart, he wants to make the array in non-decreasing order by doing the following finitely many times: he chooses two adjacent elements $$$a_i$$$ and $$$a_{i+1}$$$ ($$$1le ile n-1$$$), and increases both of them by $$$1$$$ or decre...
1,300
true
true
false
false
false
false
false
false
false
false
1,381
842D
Problem - 842D - 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
false
true
false
false
6,393
451D
Problem - 451D - 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
false
false
false
8,034
1404E
A brick is defined as a rectangle with integer side lengths with either width $$$1$$$ or height $$$1$$$ (or both). There is an $$$n imes m$$$ grid, and each cell is colored either black or white. A tiling is a way to place bricks onto the grid such that each black cell is covered by exactly one brick, and each white ce...
2,800
false
false
false
false
false
false
false
false
false
true
3,649
1814D
You've got a job in a game studio that developed an online shooter, and your first big task is to help to balance weapons. The game has $$$n$$$ weapons: the $$$i$$$-th gun has an integer fire rate $$$f_i$$$ and an integer damage per bullet $$$d_i$$$. The $$$i$$$-th gun's total firepower is equal to $$$p_i = f_i cdot d_...
2,500
true
false
false
false
true
false
true
true
false
false
1,384
2001E2
This is the hard version of the problem. The difference between the two versions is the definition of deterministic max-heap, time limit, and constraints on $$$n$$$ and $$$t$$$. You can make hacks only if both versions of the problem are solved. Consider a perfect binary tree with size $$$2^n - 1$$$, with nodes numbere...
2,900
false
false
false
true
false
false
false
false
false
false
250
204A
Problem - 204A - 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,500
false
false
false
true
false
false
false
true
false
false
9,027
1575G
Problem - 1575G - 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,200
true
false
false
false
false
false
false
false
false
false
2,762
1148F
You are given $$$n$$$ objects. Each object has two integer properties: $$$val_i$$$xa0β€” its pricexa0β€” and $$$mask_i$$$. It is guaranteed that the sum of all prices is initially non-zero. You want to select a positive integer $$$s$$$. All objects will be modified after that. The $$$i$$$-th object will be modified using t...
2,700
false
false
false
false
false
true
false
false
false
false
4,972
1580C
Kawasiro Nitori is excellent in engineering. Thus she has been appointed to help maintain trains. There are $$$n$$$ models of trains, and Nitori's department will only have at most one train of each model at any moment. In the beginning, there are no trains, at each of the following $$$m$$$ days, one train will be adde...
2,200
false
false
true
false
true
false
true
false
false
false
2,731
1437A
You got a job as a marketer in a pet shop, and your current task is to boost sales of cat food. One of the strategies is to sell cans of food in packs with discounts. Suppose you decided to sell packs with $$$a$$$ cans in a pack with a discount and some customer wants to buy $$$x$$$ cans of cat food. Then he follows a ...
800
true
true
false
false
false
true
true
false
false
false
3,485
1458F
Problem - 1458F - 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,500
false
false
false
false
true
false
false
false
false
false
3,389
1292A
NEKO#ΦωΦ has just got a new maze game on her PC! The game's main puzzle is a maze, in the forms of a $$$2 imes n$$$ rectangle grid. NEKO's task is to lead a Nekomimi girl from cell $$$(1, 1)$$$ to the gate at $$$(2, n)$$$ and escape the maze. The girl can only move between cells sharing a common side. However, at some...
1,400
false
false
true
false
true
false
false
false
false
false
4,237
1541B
You are given an array $$$a_1, a_2, dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i cdot a_j = i + j$$$. Input The first line contains one integer $$$t$$$ ($$$1 leq t leq 10^4$$$)xa0β€” the number of test cases. Then $$$t$$$ cases fo...
1,200
true
false
true
false
false
false
true
false
false
false
2,935
1097C
One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences. A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting ch...
1,400
false
true
true
false
false
false
false
false
false
false
5,222
1225G
There are $$$n$$$ positive integers written on the blackboard. Also, a positive number $$$k geq 2$$$ is chosen, and none of the numbers on the blackboard are divisible by $$$k$$$. In one operation, you can choose any two integers $$$x$$$ and $$$y$$$, erase them and write one extra number $$$f(x + y)$$$, where $$$f(x)$$...
3,100
false
true
false
true
false
true
false
false
false
false
4,545
295A
Greg has an array _a_u2009=u2009_a_1,u2009_a_2,u2009...,u2009_a__n_ and _m_ operations. Each operation looks as: _l__i_, _r__i_, _d__i_, (1u2009≀u2009_l__i_u2009≀u2009_r__i_u2009≀u2009_n_). To apply operation _i_ to the array means to increase all array elements with numbers _l__i_,u2009_l__i_u2009+u20091,u2009...,u200...
1,400
false
false
true
false
true
false
false
false
false
false
8,651
1676C
You are given $$$n$$$ words of equal length $$$m$$$, consisting of lowercase Latin alphabet letters. The $$$i$$$-th word is denoted $$$s_i$$$. In one move you can choose any position in any single word and change the letter at that position to the previous or next letter in alphabetical order. For example: you can cha...
800
true
true
true
false
false
false
true
false
false
false
2,213
1557C
Moamen and Ezzat are playing a game. They create an array $$$a$$$ of $$$n$$$ non-negative integers where every element is less than $$$2^k$$$. Moamen wins if $$$a_1 ,&, a_2 ,&, a_3 ,&, ldots ,&, a_n ge a_1 oplus a_2 oplus a_3 oplus ldots oplus a_n$$$. Here $$$&$$$ denotes the . Input The first line contains a single in...
1,700
true
false
false
true
false
false
false
false
false
false
2,845
463A
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town. Unfortunately, he has just _s_ dollars for sugar. But that's not a reason to be sad, because there are _n_ types of sugar in the supermarket, maybe he able to buy one. Bu...
1,200
false
false
true
false
false
false
true
false
false
false
7,989
1543A
Welcome to Rockport City! It is time for your first ever race in the game against Ronnie. To make the race interesting, you have bet $$$a$$$ dollars and Ronnie has bet $$$b$$$ dollars. But the fans seem to be disappointed. The excitement of the fans is given by $$$gcd(a,b)$$$, where $$$gcd(x, y)$$$ denotes the number o...
900
true
true
false
false
false
false
false
false
false
false
2,928
1132F
Problem - 1132F - 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
false
false
false
true
false
false
false
false
false
false
5,056
960E
Given a tree with $$$n$$$ nodes numbered from $$$1$$$ to $$$n$$$. Each node $$$i$$$ has an associated value $$$V_i$$$. If the simple path from $$$u_1$$$ to $$$u_m$$$ consists of $$$m$$$ nodes namely $$$u_1 ightarrow u_2 ightarrow u_3 ightarrow dots u_{m-1} ightarrow u_{m}$$$, then its alternating function $$$A(u_{1...
2,300
false
false
false
true
false
false
false
false
false
false
5,867
1799F
You have an array of positive integers $$$a_1, a_2, ldots, a_n$$$, of length $$$n$$$. You are also given a positive integer $$$b$$$. You are allowed to perform the following operations (possibly several) times in any order: 1. Choose some $$$1 le i le n$$$, and replace $$$a_i$$$ with $$$lceil frac{a_i}{2} ceil$$$. Her...
2,700
false
true
false
true
false
false
true
true
true
false
1,478
1514D
Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or...
2,000
false
true
true
false
true
false
false
true
true
false
3,093
1373D
# Maximum Sum on Even Positions Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes You are given an array a consisting of n integers. Indices of the array start from zero (i. e. the first element is a0, the second one is a1, and so on). You can reverse at most o...
1,600
false
true
true
true
false
false
false
false
false
false
3,798
267C
Berland traffic is very different from traffic in other countries. The capital of Berland consists of _n_ junctions and _m_ roads. Each road connects a pair of junctions. There can be multiple roads between a pair of junctions. For each road we know its capacity: value _c__i_ is the maximum number of cars that can driv...
2,700
true
false
false
false
false
false
false
false
false
false
8,764
67A
Problem - 67A - Codeforces =============== xa0 . The second line gives (_n_u2009-u20091) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal marks. O...
1,800
false
true
true
true
false
false
false
false
false
true
9,636
527E
The project of a data center of a Big Software Company consists of _n_ computers connected by _m_ cables. Simply speaking, each computer can be considered as a box with multiple cables going out of the box. Very Important Information is transmitted along each cable in one of the two directions. As the data center plan ...
2,600
false
false
false
false
false
false
false
false
false
true
7,720
39B
Petya works as a PR manager for a successful Berland company BerSoft. He needs to prepare a presentation on the company income growth since 2001 (the year of its founding) till now. Petya knows that in 2001 the company income amounted to _a_1 billion bourles, in 2002 β€” to _a_2 billion, ..., and in the current (2000u200...
1,300
false
true
false
false
false
false
false
false
false
false
9,799
444D
DZY loves strings, and he enjoys collecting them. In China, many people like to use strings containing their names' initials, for example: xyz, jcvb, dzy, dyh. Once DZY found a lucky string _s_. A lot of pairs of good friends came to DZY when they heard about the news. The first member of the _i_-th pair has name _a__i...
2,500
false
false
false
false
false
false
false
true
false
false
8,060
1060F
Consider a tree $$$T$$$ (that is, a connected graph without cycles) with $$$n$$$ vertices labelled $$$1$$$ through $$$n$$$. We start the following process with $$$T$$$: while $$$T$$$ has more than one vertex, do the following: choose a random edge of $$$T$$$ equiprobably; shrink the chosen edge: if the edge was conne...
2,900
false
false
false
true
false
false
false
false
false
false
5,411
847C
Recall that the bracket sequence is considered regular if it is possible to insert symbols '+' and '1' into it so that the result is a correct arithmetic expression. For example, a sequence "(()())" is regular, because we can get correct arithmetic expression insering symbols '+' and '1': "((1+1)+(1+1))". Also the foll...
1,800
false
false
false
false
false
true
false
false
false
false
6,369
1820B
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 866 (Div. 2) Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If...
1,100
true
false
false
false
false
false
false
false
false
false
1,358
120G
Let's consider the famous game called Boom (aka Hat) with simplified rules. There are _n_ teams playing the game. Each team has two players. The purpose of the game is to explain the words to the teammate without using any words that contain the same root or that sound similarly. Player _j_ from team _i_ (1u2009≀u2009_...
1,800
false
false
true
false
false
false
false
false
false
false
9,400
1906D
In The ICPC Galaxy, there exists a zone filled with asteroids that is unsafe to enter. The map of the galaxy is represented in a 2D Cartesian coordinate system. The zone is in the shape of an $$$N$$$-sided convex polygon. Each corner is numbered from $$$1$$$ to $$$N$$$; corner $$$i$$$ is located at $$$(X_i, Y_i)$$$. At...
2,800
false
false
false
false
false
false
false
true
false
false
874
717C
Harry Water, Ronaldo, Her-my-oh-knee and their friends have started a new school year at their MDCS School of Speechcraft and Misery. At the time, they are very happy to have seen each other after a long time. The sun is shining, birds are singing, flowers are blooming, and their Potions class teacher, professor Snipe ...
1,200
false
false
true
false
false
false
false
false
true
false
6,950
1773F
Scientists are researching an impact of football match results on the mood of football fans. They have a hypothesis that there is a correlation between the number of draws and fans' desire to watch football matches in the future. In football, two teams play a match. The teams score goals throughout a match. A score "$$...
800
false
false
false
false
false
true
false
false
false
false
1,651
105C
Each item in the game has a level. The higher the level is, the higher basic parameters the item has. We shall consider only the following basic parameters: attack (atk), defense (def) and resistance to different types of impact (res). Each item belongs to one class. In this problem we will only consider three of such ...
2,200
false
false
true
false
false
false
true
false
true
false
9,464
1458B
There are $$$n$$$ glasses on the table numbered $$$1, ldots, n$$$. The glass $$$i$$$ can hold up to $$$a_i$$$ units of water, and currently contains $$$b_i$$$ units of water. You would like to choose $$$k$$$ glasses and collect as much water in them as possible. To that effect you can pour water from one glass to anoth...
2,000
false
false
false
true
false
false
false
false
false
false
3,393
1157C1
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2). You are given a sequence $$$a$$$ consisting of $$$n$$$ integers. All these integers are distinct, each value from $$$1$$$ to $$$n$$$ appears in the sequence exactly once. Y...
1,300
false
true
false
false
false
false
false
false
false
false
4,921
1102D
You are given a string $$$s$$$ consisting of exactly $$$n$$$ characters, and each character is either '0', '1' or '2'. Such strings are called ternary strings. Your task is to replace minimum number of characters in this string with other characters to obtain a balanced ternary string (balanced ternary string is a tern...
1,500
false
true
false
false
false
false
false
false
false
false
5,190
65A
A long time ago (probably even in the first book), Nicholas Flamel, a great alchemist and the creator of the Philosopher's Stone, taught Harry Potter three useful spells. The first one allows you to convert _a_ grams of sand into _b_ grams of lead, the second one allows you to convert _c_ grams of lead into _d_ grams o...
1,800
true
false
true
false
false
false
false
false
false
false
9,646
508A
Pasha loves his phone and also putting his hair up... But the hair is now irrelevant. Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of _n_ row with _m_ pixels in each row. Initially, all the pixels are colored white. In one move, Pasha can choose...
1,100
false
false
false
false
false
false
true
false
false
false
7,811
1095E
Problem - 1095E - 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
false
true
false
false
false
false
false
false
false
5,233
1370F1
# The Hidden Pair (Easy Version) Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Note that the only difference between the easy and hard version is the constraint on the number of queries. You can make hacks only if all versions of the problem are solved. Th...
2,400
false
false
false
false
false
false
false
true
false
true
3,816
802H
Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she...
2,200
false
false
false
false
false
true
false
false
false
false
6,560
596E
Wilbur the pig now wants to play with strings. He has found an _n_ by _m_ table consisting only of the digits from 0 to 9 where the rows are numbered 1 to _n_ and the columns are numbered 1 to _m_. Wilbur starts at some square and makes certain moves. If he is at square (_x_, _y_) and the digit _d_ (0u2009≀u2009_d_u200...
2,500
false
false
false
true
false
false
false
false
false
true
7,461
567F
King of Berland Berl IV has recently died. Hail Berl V! As a sign of the highest achievements of the deceased king the new king decided to build a mausoleum with Berl IV's body on the main square of the capital. The mausoleum will be constructed from 2_n_ blocks, each of them has the shape of a cuboid. Each block has t...
2,400
false
false
false
true
false
false
false
false
false
false
7,579
1709B
You are beta testing the new secret Terraria update. This update will add quests to the game! Simply, the world map can be represented as an array of length $$$n$$$, where the $$$i$$$-th column of the world has height $$$a_i$$$. There are $$$m$$$ quests you have to test. The $$$j$$$-th of them is represented by two int...
900
false
false
true
true
true
false
false
false
false
false
2,025
1956C
The magical girl Nene has an $$$n imes n$$$ matrix $$$a$$$ filled with zeroes. The $$$j$$$-th element of the $$$i$$$-th row of matrix $$$a$$$ is denoted as $$$a_{i, j}$$$. She can perform operations of the following two types with this matrix: Type $$$1$$$ operation: choose an integer $$$i$$$ between $$$1$$$ and $$$n$...
1,600
true
true
false
false
false
true
false
false
false
false
538
1238F
Assume that you have $$$k$$$ one-dimensional segments $$$s_1, s_2, dots s_k$$$ (each segment is denoted by two integers β€” its endpoints). Then you can build the following graph on these segments. The graph consists of $$$k$$$ vertexes, and there is an edge between the $$$i$$$-th and the $$$j$$$-th vertexes ($$$i eq j$...
2,200
false
false
false
true
false
false
false
false
false
true
4,498
599A
Problem - 599A - 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,451
1811G2
This is hard version of the problem, it differs from the easy one only by constraints on $$$n$$$ and $$$k$$$. Vlad found a row of $$$n$$$ tiles and the integer $$$k$$$. The tiles are indexed from left to right and the $$$i$$$-th tile has the color $$$c_i$$$. After a little thought, he decided what to do with it. You ca...
2,200
true
false
false
true
true
false
false
true
false
false
1,398
894C
In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time. When he woke up, he only remembered that the key was a sequence of positive integers of some length _n_, but forgot the exact sequence. Let the elements of the sequence b...
1,900
true
false
false
false
false
true
false
false
false
false
6,173
1883F
You are given an array of integers $$$a_1, a_2, ldots, a_n$$$. Calculate the number of subarrays of this array $$$1 leq l leq r leq n$$$, such that: The array $$$b = [a_l, a_{l+1}, ldots, a_r]$$$ occurs in the array $$$a$$$ as a subsequence exactly once. In other words, there is exactly one way to select a set of indi...
1,400
false
false
false
false
true
false
false
false
false
false
986
1400B
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course. You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $$$p$$$ units and your followerxa0β€” at most $$...
1,700
true
true
false
false
false
false
true
false
false
false
3,671
1352F
For some binary string $$$s$$$ (i.e. each character $$$s_i$$$ is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length $$$2$$$ were written. For each pair (substring of length $$$2$$$), the number of '1' (ones) in it was calculated. You are given three...
1,500
true
false
false
false
false
true
false
false
false
false
3,947
1221A
You are playing a variation of game 2048. Initially you have a multiset $$$s$$$ of $$$n$$$ integers. Every integer in this multiset is a power of two. You may perform any number (possibly, zero) operations with this multiset. During each operation you choose two equal integers from $$$s$$$, remove them from $$$s$$$ and...
1,000
true
true
false
false
false
false
true
false
false
false
4,566
1466H
Getting so far in this contest is not an easy feat. By solving all the previous problems, you have impressed the gods greatly. Thus, they decided to spare you the story for this problem and grant a formal statement instead. Consider $$$n$$$ agents. Each one of them initially has exactly one item, $$$i$$$-th agent has t...
3,300
true
true
false
true
false
false
false
false
false
true
3,359
1659A
Team Red and Team Blue competed in a competitive FPS. Their match was streamed around the world. They played a series of $$$n$$$ matches. In the end, it turned out Team Red won $$$r$$$ times and Team Blue won $$$b$$$ times. Team Blue was less skilled than Team Red, so $$$b$$$ was strictly less than $$$r$$$. You missed ...
1,000
true
true
true
false
false
true
false
false
false
false
2,332
313B
Problem - 313B - 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
true
false
false
false
false
false
false
8,594
1910G
Alice and Bob are swimming in the pool under the guidance of their instructor Monocarp. The pool can be represented as a segment on the OX-axis from $$$0$$$ to $$$50$$$. Both Alice and Bob started at moment $$$0$$$ at point $$$0$$$ with positive real speeds $$$v_A$$$ and $$$v_B$$$ correspondingly. Both Alice and Bob sw...
2,700
false
true
false
false
false
false
false
false
false
false
841
1186F
Vus the Cossack has a simple graph with $$$n$$$ vertices and $$$m$$$ edges. Let $$$d_i$$$ be a degree of the $$$i$$$-th vertex. Recall that a degree of the $$$i$$$-th vertex is the number of conected edges to the $$$i$$$-th vertex. He needs to remain not more than $$$lceil frac{n+m}{2} ceil$$$ edges. Let $$$f_i$$$ be ...
2,400
false
true
true
false
false
false
false
false
false
true
4,767
773E
It's well-known that blog posts are an important part of Codeforces platform. Every blog post has a global characteristic changing over timexa0β€” its community rating. A newly created blog post's community rating is 0. Codeforces users may visit the blog post page and rate it, changing its community rating by +1 or -1. ...
3,000
false
false
false
false
true
false
false
false
true
false
6,683
786E
ALT is a planet in a galaxy called "Encore". Humans rule this planet but for some reason there's no dog in their planet, so the people there are sad and depressed. Rick and Morty are universal philanthropists and they want to make people in ALT happy. ALT has _n_ cities numbered from 1 to _n_ and _n_u2009-u20091 bidire...
3,200
false
false
false
false
true
false
false
false
false
true
6,624
1878B
After the Serbian Informatics Olympiad, Aleksa was very sad, because he didn't win a medal (he didn't know stack), so Vasilije came to give him an easy problem, just to make his day better. Vasilije gave Aleksa a positive integer $$$n$$$ ($$$n ge 3$$$) and asked him to construct a strictly increasing array of size $$$n...
800
true
false
false
false
false
true
false
false
false
false
1,016
1903D2
This is the hard 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$$$ ...
2,500
false
true
false
true
false
false
false
false
false
false
893
588B
Problem - 588B - 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
false
false
false
false
false
7,490
1060A
Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not. You have $$$n$$$ cards with digits, and you want to use them to make as many pho...
800
false
false
false
false
false
false
true
false
false
false
5,416
653B
Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd', 'e' and 'f'. You are given a set of _q_ possible operations. Limak can perform them in any order,...
1,300
false
false
false
true
false
false
true
false
false
false
7,203
1214F
Two large companies "Cecsi" and "Poca Pola" are fighting against each other for a long time. In order to overcome their competitor, "Poca Pola" started a super secret project, for which it has total $$$n$$$ vacancies in all of their offices. After many tests and interviews $$$n$$$ candidates were selected and the only ...
2,700
false
true
false
false
false
false
false
false
true
false
4,606
2014D
Impress thy brother, yet fret not thy mother. Robin's brother and mother are visiting, and Robin gets to choose the start day for each visitor. All days are numbered from $$$1$$$ to $$$n$$$. Visitors stay for $$$d$$$ continuous days, all of those $$$d$$$ days must be between day $$$1$$$ and $$$n$$$ inclusive. Robin has...
1,400
false
true
false
false
true
false
true
false
true
false
168
906D
Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its bottom. If top, which is built from _k_u2009-u20091 rocks, possesses power _p_ an...
2,700
true
false
false
false
false
false
false
false
false
false
6,124
1163C1
This problem is same as the next one, but has smaller constraints. It was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). After arriving at the power station, the cats got impressed with a large power transmission system consi...
1,900
false
false
false
false
false
false
true
false
false
false
4,901
1285A
Today, Mezo is playing a game. Zoma, a character in that game, is initially at position $$$x = 0$$$. Mezo starts sending $$$n$$$ commands to Zoma. There are two possible commands: 'L' (Left) sets the position $$$x: =x - 1$$$; 'R' (Right) sets the position $$$x: =x + 1$$$. Unfortunately, Mezo's controller malfunctions...
800
true
false
false
false
false
false
false
false
false
false
4,267
1586I
Omkar is creating a mosaic using colored square tiles, which he places in an $$$n imes n$$$ grid. When the mosaic is complete, each cell in the grid will have either a glaucous or sinoper tile. However, currently he has only placed tiles in some cells. A completed mosaic will be a mastapeece if and only if each tile i...
3,500
true
false
false
false
false
true
false
false
false
false
2,695
568A
Rikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number is another matter. It is aesthetically pleasing, and it has a number of remarkable properties. Help Rikhail to convince the scientific community in this! Let us remind you ...
1,600
true
false
true
false
false
false
true
false
false
false
7,578
1458A
Problem - 1458A - 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,600
true
false
false
false
false
false
false
false
false
false
3,394
1811E
Problem - 1811E - 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
true
false
false
false
true
false
false
1,401
141C
In the Main Berland Bank _n_ people stand in a queue at the cashier, everyone knows his/her height _h__i_, and the heights of the other people in the queue. Each of them keeps in mind number _a__i_ β€” how many people who are taller than him/her and stand in queue in front of him. After a while the cashier has a lunch br...
1,800
false
true
false
false
false
true
false
false
true
false
9,310
1009C
Alice got an array of length $$$n$$$ as a birthday present once again! This is the third year in a row! And what is more disappointing, it is overwhelmengly boring, filled entirely with zeros. Bob decided to apply some changes to the array to cheer up Alice. Bob has chosen $$$m$$$ changes of the following form. For som...
1,700
true
true
false
false
false
false
false
false
false
false
5,640
98B
This is the modification of the problem used during the official round. Unfortunately, author's solution of the original problem appeared wrong, so the problem was changed specially for the archive. Once upon a time in a far away kingdom lived the King. The King had a beautiful daughter, Victoria. They lived happily, b...
2,200
false
false
true
false
false
false
false
false
false
false
9,495
232D
John Doe has a crooked fence, consisting of _n_ rectangular planks, lined up from the left to the right: the plank that goes _i_-th (1u2009≀u2009_i_u2009≀u2009_n_) (from left to right) has width 1 and height _h__i_. We will assume that the plank that goes _i_-th (1u2009≀u2009_i_u2009≀u2009_n_) (from left to right) has ...
2,900
false
false
false
false
true
false
false
true
false
false
8,908
379B
The New Year is coming! That's why many people today are busy preparing New Year presents. Vasily the Programmer is no exception. Vasily knows that the best present is (no, it's not a contest) money. He's put _n_ empty wallets from left to right in a row and decided how much money to put in what wallet. Vasily decided ...
1,200
false
false
true
false
false
true
false
false
false
false
8,316
962G
Petya has a polygon consisting of $$$n$$$ vertices. All sides of the Petya's polygon are parallel to the coordinate axes, and each two adjacent sides of the Petya's polygon are perpendicular. It is guaranteed that the polygon is simple, that is, it doesn't have self-intersections and self-touches. All internal area of ...
2,800
false
false
false
false
true
false
false
false
false
false
5,850
1485E
You are given $$$n - 1$$$ integers $$$a_2, dots, a_n$$$ and a tree with $$$n$$$ vertices rooted at vertex $$$1$$$. The leaves are all at the same distance $$$d$$$ from the root. Recall that a tree is a connected undirected graph without cycles. The distance between two vertices is the number of edges on the simple path...
2,500
false
true
false
true
false
false
false
false
false
false
3,255
1355E
Problem - 1355E - 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,100
true
true
false
false
false
false
false
true
true
false
3,927
331A1
β€” Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me? β€” Of course, my Smart Beaver! Let us enjoy the splendid view together. How about Friday night? At this point the Smart Beaver got rushing. Everything should be perfect by Friday, so he needed to prepare the belt to the upcoming wa...
1,400
false
false
true
false
false
false
true
false
false
false
8,522