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
1520B
Problem - 1520B - 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
true
false
false
false
3,062
650E
My name is James diGriz, I'm the most clever robber and treasure hunter in the whole galaxy. There are books written about my adventures and songs about my operations, though you were able to catch me up in a pretty awkward moment. I was able to hide from cameras, outsmart all the guards and pass numerous traps, but wh...
3,200
false
true
false
false
true
false
false
false
false
false
7,213
796F
Zane once had a good sequence _a_ consisting of _n_ integers _a_1,u2009_a_2,u2009...,u2009_a__n_xa0— but he has lost it. A sequence is said to be good if and only if all of its integers are non-negative and do not exceed 109 in value. However, Zane remembers having played around with his sequence by applying _m_ operat...
2,800
false
true
false
false
true
false
false
false
false
false
6,588
960F
You are given a directed graph with _n_ nodes and _m_ edges, with all edges having a certain weight. There might be multiple edges and self loops, and the graph can also be disconnected. You need to choose a path (possibly passing through same vertices multiple times) in the graph such that the weights of the edges are...
2,100
false
false
false
true
true
false
false
false
false
true
5,866
1973E
Fox has found an array $$$p_1, p_2, ldots, p_n$$$, that is a permutation of length $$$n^dagger$$$ of the numbers $$$1, 2, ldots, n$$$. She wants to sort the elements in increasing order. Cat wants to help her — he is able to swap any two numbers $$$x$$$ and $$$y$$$ in the array, but only if $$$l leq x + y leq r$$$ (not...
2,500
true
false
false
false
false
false
false
false
true
true
451
280C
Momiji has got a rooted tree, consisting of _n_ nodes. The tree nodes are numbered by integers from 1 to _n_. The root has number 1. Momiji decided to play a game on this tree. The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by _v_) and removes all the s...
2,200
true
false
true
false
false
false
false
false
false
false
8,713
788D
After some programming contest Roma decided to try himself in tourism. His home country Uzhlyandia is a Cartesian plane. He wants to walk along each of the Main Straight Lines in Uzhlyandia. It is known that each of these lines is a straight line parallel to one of the axes (i.e. it is described with the equation _x_u2...
3,000
false
false
false
false
false
true
false
false
false
false
6,618
1991F
You are given $$$n$$$ sticks, numbered from $$$1$$$ to $$$n$$$. The length of the $$$i$$$-th stick is $$$a_i$$$. You need to answer $$$q$$$ queries. In each query, you are given two integers $$$l$$$ and $$$r$$$ ($$$1 le l < r le n$$$, $$$r - l + 1 ge 6$$$). Determine whether it is possible to choose $$$6$$$ distinct st...
2,200
true
true
true
false
false
false
true
false
true
false
323
39C
There are lots of theories concerning the origin of moon craters. Most scientists stick to the meteorite theory, which says that the craters were formed as a result of celestial bodies colliding with the Moon. The other version is that the craters were parts of volcanoes. An extraterrestrial intelligence research speci...
2,100
false
false
false
true
false
false
false
false
true
false
9,798
1515C
Phoenix has $$$n$$$ blocks of height $$$h_1, h_2, dots, h_n$$$, and all $$$h_i$$$ don't exceed some value $$$x$$$. He plans to stack all $$$n$$$ blocks into $$$m$$$ separate towers. The height of a tower is simply the sum of the heights of its blocks. For the towers to look beautiful, no two towers may have a height di...
1,400
false
true
false
false
true
true
false
false
false
false
3,089
843A
You are given a sequence _a_1,u2009_a_2,u2009...,u2009_a__n_ consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order. Sorting integers ...
1,400
true
false
true
false
false
false
false
false
true
false
6,391
1237F
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino. Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cell...
2,600
false
false
false
true
false
false
false
false
false
false
4,506
2029G
There is an array $$$a$$$ consisting of $$$n$$$ integers. Initially, all elements of $$$a$$$ are equal to $$$0$$$. Kevin can perform several operations on the array. Each operation is one of the following two types: Prefix additionxa0— Kevin first selects an index $$$x$$$ ($$$1le xle n$$$), and then for each $$$1le jl...
3,000
false
false
false
true
true
false
false
false
false
false
91
1408H
You are given a sequence $$$a_1, a_2, ldots, a_n$$$ of non-negative integers. You need to find the largest number $$$m$$$ of triples $$$(i_1, j_1, k_1)$$$, $$$(i_2, j_2, k_2)$$$, ..., $$$(i_m, j_m, k_m)$$$ such that: $$$1 leq i_p < j_p < k_p leq n$$$ for each $$$p$$$ in $$$1, 2, ldots, m$$$; $$$a_{i_p} = a_{k_p} = 0$...
3,300
false
true
false
false
true
false
false
true
false
false
3,629
883H
Problem - 883H - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,800
false
false
true
false
false
false
true
false
false
false
6,220
1978F
Given an array $$$a$$$ of length $$$n$$$. Let's construct a square matrix $$$b$$$ of size $$$n imes n$$$, in which the $$$i$$$-th row contains the array $$$a$$$ cyclically shifted to the right by $$$(i - 1)$$$. For example, for the array $$$a = — the number of test cases. The description of the test cases follows. Th...
2,400
false
false
false
false
true
false
false
false
false
true
417
1583F
Even if you just leave them be, they will fall to pieces all by themselves. So, someone has to protect them, right? You find yourself playing with Teucer again in the city of Liyue. As you take the eccentric little kid around, you notice something interesting about the structure of the city. Liyue can be represented as...
2,500
false
false
false
false
false
true
false
false
false
false
2,712
1864C
You are given an integer $$$x$$$. Your task is to reduce $$$x$$$ to $$$1$$$. To do that, you can do the following operation: select a divisor $$$d$$$ of $$$x$$$, then change $$$x$$$ to $$$x-d$$$, i.e. reduce $$$x$$$ by $$$d$$$. (We say that $$$d$$$ is a divisor of $$$x$$$ if $$$d$$$ is an positive integer and there ex...
1,300
true
false
false
false
false
true
false
false
false
false
1,095
1891F
You are given a rooted tree with the root at vertex $$$1$$$, initially consisting of a single vertex. Each vertex has a numerical value, initially set to $$$0$$$. There are also $$$q$$$ queries of two types: The first type: add a child vertex with the number $$$sz + 1$$$ to vertex $$$v$$$, where $$$sz$$$ is the curren...
2,000
false
false
false
false
true
false
false
false
false
false
952
1400F
You are given an integer value $$$x$$$ and a string $$$s$$$ consisting of digits from $$$1$$$ to $$$9$$$ inclusive. A substring of a string is a contiguous subsequence of that string. Let $$$f(l, r)$$$ be the sum of digits of a substring $$$s[l..r]$$$. Let's call substring $$$s[l_1..r_1]$$$ $$$x$$$-prime if $$$f(l_1, ...
2,800
false
false
false
true
false
false
true
false
false
false
3,667
268C
Problem - 268C - 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
true
false
false
true
false
false
false
false
8,761
853A
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are _n_ flights that must depart today, the _i_-th of them is planned to depart at the _i_-th minute of the day. Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This...
1,500
false
true
false
false
false
false
false
false
false
false
6,334
182B
Vasya lives in a strange world. The year has _n_ months and the _i_-th month has _a__i_ days. Vasya got a New Year present — the clock that shows not only the time, but also the date. The clock's face can display any number from 1 to _d_. It is guaranteed that _a__i_u2009≤u2009_d_ for all _i_ from 1 to _n_. The clock d...
1,000
false
false
true
false
false
false
false
false
false
false
9,113
1624E
Masha meets a new friend and learns his phone numberxa0— $$$s$$$. She wants to remember it as soon as possible. The phone numberxa0— is a string of length $$$m$$$ that consists of digits from $$$0$$$ to $$$9$$$. The phone number may start with 0. Masha already knows $$$n$$$ phone numbers (all numbers have the same leng...
2,000
false
false
true
true
false
true
true
false
false
false
2,496
1004B
Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition. There are $$$n$$$ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $$$i$$$-th position. Thus each of $$$n$$$ posi...
1,300
true
true
true
false
false
true
false
false
false
false
5,667
435C
In this problem, your task is to use ASCII graphics to paint a cardiogram. A cardiogram is a polyline with the following corners: That is, a cardiogram is fully defined by a sequence of positive integers _a_1,u2009_a_2,u2009...,u2009_a__n_. Your task is to paint a cardiogram by given sequence _a__i_. Input The first li...
1,600
false
false
true
false
false
false
false
false
false
false
8,100
1334E
You are given a positive integer $$$D$$$. Let's build the following graph from it: each vertex is a divisor of $$$D$$$ (not necessarily prime, $$$1$$$ and $$$D$$$ itself are also included); two vertices $$$x$$$ and $$$y$$$ ($$$x > y$$$) have an undirected edge between them if $$$x$$$ is divisible by $$$y$$$ and $$$fr...
2,200
true
true
false
false
false
false
false
false
false
true
4,033
1998E2
Drink water. — Sun Tzu, The Art of Becoming a Healthy Programmer This is the hard version of the problem. The only difference is that $$$x=1$$$ in this version. You must solve both versions to be able to hack. You are given two integers $$$n$$$ and $$$x$$$ ($$$x=1$$$). There are $$$n$$$ balls lined up in a row, numbere...
2,500
false
true
true
false
true
false
true
true
false
false
272
1165D
We guessed some integer number $$$x$$$. You are given a list of almost all its divisors. Almost all means that there are all divisors except $$$1$$$ and $$$x$$$ in the list. Your task is to find the minimum possible integer $$$x$$$ that can be the guessed number, or say that the input data is contradictory and it is im...
1,600
true
false
false
false
false
false
false
false
false
false
4,893
1994C
Yaroslav is playing a computer game, and at one of the levels, he encountered $$$n$$$ mushrooms arranged in a row. Each mushroom has its own level of toxicity; the $$$i$$$-th mushroom from the beginning has a toxicity level of $$$a_i$$$. Yaroslav can choose two integers $$$1 le l le r le n$$$, and then his character wi...
1,600
false
false
false
true
false
false
false
true
false
false
303
1488B
A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence (or, shortly, an RBS) is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example: bracket sequences ...
1,800
false
true
false
false
false
false
false
false
false
false
3,238
577A
Problem - 577A - 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,000
false
false
true
false
false
false
false
false
false
false
7,538
740B
Little Alyona is celebrating Happy Birthday! Her mother has an array of _n_ flowers. Each flower has some mood, the mood of _i_-th flower is _a__i_. The mood can be positive, zero or negative. Let's define a subarray as a segment of consecutive flowers. The mother suggested some set of subarrays. Alyona wants to choose...
1,200
false
false
false
false
false
true
false
false
false
false
6,837
1263F
An electrical grid in Berland palaces consists of 2 grids: main and reserve. Wires in palaces are made of expensive material, so selling some of them would be a good idea! Each grid (main and reserve) has a head node (its number is $$$1$$$). Every other node gets electricity from the head node. Each node can be reached...
2,400
false
false
false
true
true
false
false
false
false
true
4,382
1638C
You are given a permutation $$$p_1, p_2, dots, p_n$$$. Then, an undirected graph is constructed in the following way: add an edge between vertices $$$i$$$, $$$j$$$ such that $$$i < j$$$ if and only if $$$p_i > p_j$$$. Your task is to count the number of connected components in this graph. Two vertices $$$u$$$ and $$$v$...
1,300
true
false
false
false
true
false
false
false
false
true
2,424
873B
Problem - 873B - Codeforces =============== xa0 equals to the number of ones in this substring. You have to determine the length of the longest balanced substring of _s_. Input The first line contains _n_ (1u2009≤u2009_n_u2009≤u2009100000) — the number of characters in _s_. The second line contains a stri...
1,500
false
false
true
true
false
false
false
false
false
false
6,253
188H
Problem - 188H - Codeforces =============== xa0 on them and push the result on the stack. You are given a string which describes the sequence of operations to be performed on the stack. _i_-th character corresponds to _i_-th operation: If _i_-th character is a digit, push the corresponding number on the ...
1,800
false
false
true
false
false
false
false
false
false
false
9,085
1598E
You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The rows are numbered top to bottom, the columns are numbered left to right. Each cell of the matrix can be either free or locked. Let's call a path in the matrix a staircase if it: starts and ends in the free cell; visits only free cells; has o...
2,100
true
false
true
true
true
false
true
false
false
false
2,667
774F
Stepan has _n_ pens. Every day he uses them, and on the _i_-th day he uses the pen number _i_. On the (_n_u2009+u20091)-th day again he uses the pen number 1, on the (_n_u2009+u20092)-th — he uses the pen number 2 and so on. On every working day (from Monday to Saturday, inclusive) Stepan spends exactly 1 milliliter of...
2,700
false
false
false
false
false
false
false
true
false
false
6,676
452C
Alex enjoys performing magic tricks. He has a trick that requires a deck of _n_ cards. He has _m_ identical decks of _n_ different cards each, which have been mixed together. When Alex wishes to perform the trick, he grabs _n_ cards at random and performs the trick with those. The resulting deck looks like a normal dec...
2,100
true
false
false
false
false
false
false
false
false
false
8,030
1916E
Egor and his friend Arseniy are finishing school this year and will soon enter university. And since they are very responsible guys, they have started preparing for admission already. First of all, they decided to take care of where they will live for the long four years of study, and after visiting the university's we...
2,300
false
true
false
false
true
false
false
false
false
false
799
922C
Problem - 922C - 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
false
false
false
false
false
true
false
false
false
6,027
182A
Vasya lagged behind at the University and got to the battlefield. Just joking! He's simply playing some computer game. The field is a flat platform with _n_ trenches dug on it. The trenches are segments on a plane parallel to the coordinate axes. No two trenches intersect. There is a huge enemy laser far away from Vasy...
2,200
false
false
true
false
false
false
false
false
false
true
9,114
978D
Polycarp likes arithmetic progressions. A sequence $$$[a_1, a_2, dots, a_n]$$$ is called an arithmetic progression if for each $$$i$$$ ($$$1 le i < n$$$) the value $$$a_{i+1} - a_i$$$ is the same. For example, the sequences $$$[42]$$$, $$$[5, 5, 5]$$$, $$$[2, 11, 20, 29]$$$ and $$$[3, 2, 1, 0]$$$ are arithmetic progres...
1,500
true
false
true
false
false
false
true
false
false
false
5,815
1728E
Monocarp is going to host a party for his friends. He prepared $$$n$$$ dishes and is about to serve them. First, he has to add some powdered pepper to each of themxa0— otherwise, the dishes will be pretty tasteless. The $$$i$$$-th dish has two values $$$a_i$$$ and $$$b_i$$$xa0— its tastiness with red pepper added or bl...
2,300
true
true
false
false
true
false
true
false
false
false
1,921
597A
. Output Print the required number.
1,600
true
false
false
false
false
false
false
false
false
false
7,460
1950C
Given the time in 24-hour format, output the equivalent time in 12-hour format. xa0— the number of test cases. The only line of each test case contains a string $$$s$$$ of length $$$5$$$ with format hh:mm representing a valid time in the 24-hour format. hh represents the hour from $$$00$$$ to $$$23$$$, and mm represen...
800
true
false
true
false
false
false
false
false
false
false
579
1310C
VK just opened its second HQ in St. Petersburg! Side of its office building has a huge string $$$s$$$ written on its side. This part of the office is supposed to be split into $$$m$$$ meeting rooms in such way that meeting room walls are strictly between letters on the building. Obviously, meeting rooms should not be o...
2,800
false
false
false
true
false
false
false
true
false
false
4,147
1651B
Recently, your friend discovered one special operation on an integer array $$$a$$$: 1. Choose two indices $$$i$$$ and $$$j$$$ ($$$i eq j$$$); 2. Set $$$a_i = a_j = a_i - a_j$$$. After playing with this operation for a while, he came to the next conclusion: For every array $$$a$$$ of $$$n$$$ integers, where $$$1 le a_...
800
false
true
false
false
false
true
false
false
false
false
2,367
1535A
Four players participate in the playoff tournament. The tournament is held according to the following scheme: the first player will play with the second, and the third player with the fourth, then the winners of the pairs will play in the finals of the tournament. It is known that in a match between two players, the on...
800
false
false
true
false
false
false
true
false
false
false
2,974
712D
Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score _a_ and Lexa starts with score _b_. In a single turn, both Memory and Lexa get some integer in the range [u2009-u2009_k_;_k_] (i.e. one integer among u2009-u2009_k_,u2009u2009-u2009_k_u2009+u20091,u2009u2...
2,200
true
false
false
true
false
false
false
false
false
false
6,968
1394B
Boboniu has a directed graph with $$$n$$$ vertices and $$$m$$$ edges. The out-degree of each vertex is at most $$$k$$$. Each edge has an integer weight between $$$1$$$ and $$$m$$$. No two edges have equal weights. Boboniu likes to walk on the graph with some specific rules, which is represented by a tuple $$$(c_1,c_2,l...
2,300
false
false
false
false
false
false
true
false
false
true
3,700
197A
Problem - 197A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,600
true
false
false
false
false
true
false
false
false
false
9,053
1608G
Problem - 1608G - 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
true
false
false
2,609
1725C
Pak Chanek has a mirror in the shape of a circle. There are $$$N$$$ lamps on the circumference numbered from $$$1$$$ to $$$N$$$ in clockwise order. The length of the arc from lamp $$$i$$$ to lamp $$$i+1$$$ is $$$D_i$$$ for $$$1 leq i leq N-1$$$. Meanwhile, the length of the arc between lamp $$$N$$$ and lamp $$$1$$$ is ...
2,000
true
false
false
false
false
false
false
true
false
false
1,944
1614C
Once Divan analyzed a sequence $$$a_1, a_2, ldots, a_n$$$ consisting of $$$n$$$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $$$a$$$, computed the elements. For example, $$$ — the number of test cases. The first line of each test case contains two integer numbers $$$n$$$ an...
1,500
true
false
false
true
false
true
false
false
false
false
2,568
1109B
Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t...
1,800
false
false
false
false
false
true
false
false
false
false
5,154
733D
Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marble from which he can carve the sphere. Zahar has _n_ stones which are rectangul...
1,600
false
false
false
false
true
false
false
false
false
false
6,861
749C
There are _n_ employees in Alternative Cake Manufacturing (ACM). They are now voting on some very important question and the leading world media are trying to predict the outcome of the vote. Each of the employees belongs to one of two fractions: depublicans or remocrats, and these two fractions have opposite opinions ...
1,500
false
true
true
false
false
false
false
false
false
false
6,796
1090E
, # Problem A. Horseback Riding Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 512 megabytes It is well known that chess is a sport. But Dima, who is into horseback riding, considers it boring, and not a sport at all. His friend Sasha has decided to show him how complex an...
2,300
false
false
false
false
false
false
false
false
false
true
5,268
1488D
Polycarp has decided to do a problemsolving marathon. He wants to solve $$$s$$$ problems in $$$n$$$ days. Let $$$a_i$$$ be the number of problems he solves during the $$$i$$$-th day. He wants to find a distribution of problems into days such that: $$$a_i$$$ is an integer value for all $$$i$$$ from $$$1$$$ to $$$n$$$; ...
1,900
false
true
false
false
false
false
false
true
false
false
3,236
1906J
You are currently researching a graph traversal algorithm called the Breadth First Search (BFS). Suppose you have an input graph of $$$N$$$ nodes (numbered from $$$1$$$ to $$$N$$$). The graph is represented by an adjacency matrix $$$M$$$, for which node $$$u$$$ can traverse to node $$$v$$$ if $$$M_{u, v}$$$ is $$$1$$$,...
2,100
false
false
false
true
false
false
false
false
false
false
868
154D
The King of Flatland will organize a knights' tournament! The winner will get half the kingdom and the favor of the princess of legendary beauty and wisdom. The final test of the applicants' courage and strength will be a fencing tournament. The tournament is held by the following rules: the participants fight one on o...
2,400
true
false
false
false
false
false
false
false
false
false
9,256
1797A
There is a rectangular maze of size $$$n imes m$$$. Denote $$$(r,c)$$$ as the cell on the $$$r$$$-th row from the top and the $$$c$$$-th column from the left. Two cells are adjacent if they share an edge. A path is a sequence of adjacent empty cells. Each cell is initially empty. Li Hua can choose some cells (except $$...
800
false
true
true
false
false
true
false
false
false
true
1,496
2035B
Problem - 2035B - Codeforces =============== xa0 ]( "Codeforces Global Round 27") xa0— the number of test cases. The only line of each test case contains a single integer $$$n$$$ ($$$1le nle 500$$$)xa0— the length of the decimal representation. Output For each test case, output the smallest required intege...
900
true
true
false
false
false
true
false
false
false
false
60
1428G2
This is the hard version of the problem. The only difference is in the constraint on $$$q$$$. You can make hacks only if all versions of the problem are solved. Zookeeper has been teaching his $$$q$$$ sheep how to write and how to add. The $$$i$$$-th sheep has to write exactly $$$k$$$ non-negative integers with the sum...
3,000
false
true
false
true
false
false
false
false
false
false
3,518
2032B
You are given an array $$$a = [1, 2, ldots, n]$$$, where $$$n$$$ is odd, and an integer $$$k$$$. Your task is to choose an odd positive integer $$$m$$$ and to split $$$a$$$ into $$$m$$$ subarrays$$$^{dagger}$$$ $$$b_1, b_2, ldots, b_m$$$ such that: Each element of the array $$$a$$$ belongs to exactly one subarray. Fo...
1,100
true
true
true
false
false
true
false
false
false
false
73
777C
During the lesson small girl Alyona works with one famous spreadsheet computer program and learns how to edit tables. Now she has a table filled with integers. The table consists of _n_ rows and _m_ columns. By _a__i_,u2009_j_ we will denote the integer located at the _i_-th row and the _j_-th column. We say that the t...
1,600
false
true
true
true
true
false
false
true
false
false
6,659
1556G
As mentioned previously William really likes playing video games. In one of his favorite games, the player character is in a universe where every planet is designated by a binary number from $$$0$$$ to $$$2^n - 1$$$. On each planet, there are gates that allow the player to move from planet $$$i$$$ to planet $$$j$$$ if ...
3,300
false
false
false
false
true
false
false
false
false
false
2,849
1920A
Alex is solving a problem. He has $$$n$$$ constraints on what the integer $$$k$$$ can be. There are three types of constraints: 1. $$$k$$$ must be greater than or equal to some integer $$$x$$$; 2. $$$k$$$ must be less than or equal to some integer $$$x$$$; 3. $$$k$$$ must be not equal to some integer $$$x$$$. Help Alex...
800
true
true
false
false
false
false
true
false
false
false
772
859C
You may have heard of the pie rule before. It states that if two people wish to fairly share a slice of pie, one person should cut the slice in half, and the other person should choose who gets which slice. Alice and Bob have many slices of pie, and rather than cutting the slices in half, each individual slice will be ...
1,500
false
false
false
true
false
false
false
false
false
false
6,306
1997D
You are given a rooted tree, consisting of $$$n$$$ vertices. The vertices in the tree are numbered from $$$1$$$ to $$$n$$$, and the root is the vertex $$$1$$$. The value $$$a_i$$$ is written at the $$$i$$$-th vertex. You can perform the following operation any number of times (possibly zero): choose a vertex $$$v$$$ wh...
1,500
false
true
false
true
false
false
false
true
false
false
280
1769A
Statement is not available on English language Колонна из $$$n$$$ самокатов едет по узкой односторонней дороге в пункт Б. Самокаты пронумерованы от $$$1$$$ до $$$n$$$. Для каждого самоката $$$i$$$ известно, что текущее расстояние от него до пункта Б равно $$$a_i$$$ метров. При этом $$$a_1 < a_2 < ldots < a_n$$$, в част...
800
true
false
false
false
false
false
false
false
false
false
1,685
1506E
A permutation is a sequence of $$$n$$$ integers from $$$1$$$ to $$$n$$$, in which all numbers occur exactly once. For example, $$$[1]$$$, $$$[3, 5, 2, 1, 4]$$$, $$$[1, 3, 2]$$$ are permutations, and $$$[2, 3, 2]$$$, $$$[4, 3, 1]$$$, $$$[0]$$$ are not. Polycarp was presented with a permutation $$$p$$$ of numbers from $$...
1,500
false
false
true
false
false
true
false
false
false
false
3,139
670E
Recently Polycarp started to develop a text editor that works only with correct bracket sequences (abbreviated as CBS). Note that a bracket sequence is correct if it is possible to get a correct mathematical expression by adding "+"-s and "1"-s to it. For example, sequences "(())()", "()" and "(()(()))" are correct, wh...
1,700
false
false
false
false
true
false
false
false
false
false
7,142
1157F
There are $$$n$$$ people in a row. The height of the $$$i$$$-th person is $$$a_i$$$. You can choose any subset of these people and try to arrange them into a balanced circle. A balanced circle is such an order of people that the difference between heights of any adjacent people is no more than $$$1$$$. For example, let...
2,000
false
true
false
true
false
true
false
false
false
false
4,917
1856A
Alphen has an array of positive integers $$$a$$$ of length $$$n$$$. Alphen can perform the following operation: For all $$$i$$$ from $$$1$$$ to $$$n$$$, replace $$$a_i$$$ with $$$max(0, a_i - 1)$$$. Alphen will perform the above operation until $$$a$$$ is sorted, that is $$$a$$$ satisfies $$$a_1 leq a_2 leq ldots leq ...
800
false
false
true
false
false
false
false
false
false
false
1,150
107C
In the year 2500 the annual graduation ceremony in the German University in Cairo (GUC) has run smoothly for almost 500 years so far. The most important part of the ceremony is related to the arrangement of the professors in the ceremonial hall. Traditionally GUC has _n_ professors. Each professor has his seniority lev...
2,400
false
false
false
true
false
false
false
false
false
false
9,454
1795F
You are given a tree, consisting of $$$n$$$ vertices. There are $$$k$$$ chips, placed in vertices $$$a_1, a_2, dots, a_k$$$. All $$$a_i$$$ are distinct. Vertices $$$a_1, a_2, dots, a_k$$$ are colored black initially. The remaining vertices are white. You are going to play a game where you perform some moves (possibly, ...
2,400
false
true
false
false
false
true
false
true
false
false
1,504
758B
Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland. Now he has a goal to replace dead light bulbs, however he doesn't know how many light bulbs for each color are required. It is guaranteed that for each of four colors at least one light is working...
1,100
false
false
true
false
false
false
true
false
false
false
6,756
1615E
Two players, Red and Blue, are at it again, and this time they're playing with crayons! The mischievous duo is now vandalizing a rooted tree, by coloring the nodes while playing their favorite game. The game works as follows: there is a tree of size $$$n$$$, rooted at node $$$1$$$, where each node is initially white. R...
2,400
true
true
false
false
true
false
false
false
true
true
2,560
63E
Problem - 63E - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so...
2,000
false
false
true
true
false
false
false
false
false
false
9,656
213A
Furik and Rubik love playing computer games. Furik has recently found a new game that greatly interested Rubik. The game consists of _n_ parts and to complete each part a player may probably need to complete some other ones. We know that the game can be fully completed, that is, its parts do not form cyclic dependencie...
1,700
false
true
false
false
false
false
false
false
false
false
8,988
704A
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are _n_ applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't). _q_ events are a...
1,600
false
false
true
false
true
false
true
false
false
false
7,006
1059D
There is a forest that we model as a plane and live $$$n$$$ rare animals. Animal number $$$i$$$ has its lair in the point $$$(x_{i}, y_{i})$$$. In order to protect them, a decision to build a nature reserve has been made. The reserve must have a form of a circle containing all lairs. There is also a straight river flow...
2,200
false
false
false
false
false
false
false
true
false
false
5,418
1467B
You are given a sequence of $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$. Let us call an index $$$j$$$ ($$$2 le j le {{n-1}}$$$) a hill if $$$a_j > a_{{j+1}}$$$ and $$$a_j > a_{{j-1}}$$$; and let us call it a valley if $$$a_j < a_{{j+1}}$$$ and $$$a_j < a_{{j-1}}$$$. Let us define the intimidation value of a s...
1,700
false
false
true
false
false
false
true
false
false
false
3,356
337A
The end of the school year is near and Ms. Manana, the teacher, will soon have to say goodbye to a yet another class. She decided to prepare a goodbye present for her _n_ students and give each of them a jigsaw puzzle (which, as wikipedia states, is a tiling puzzle that requires the assembly of numerous small, often od...
900
false
true
false
false
false
false
false
false
false
false
8,487
1575A
Andi and Budi were given an assignment to tidy up their bookshelf of $$$n$$$ books. Each book is represented by the book title — a string $$$s_i$$$ numbered from $$$1$$$ to $$$n$$$, each with length $$$m$$$. Andi really wants to sort the book lexicographically ascending, while Budi wants to sort it lexicographically de...
1,100
false
false
false
false
true
false
false
false
true
false
2,768
1633D
You have an array of integers $$$a$$$ of size $$$n$$$. Initially, all elements of the array are equal to $$$1$$$. You can perform the following operation: choose two integers $$$i$$$ ($$$1 le i le n$$$) and $$$x$$$ ($$$x > 0$$$), and then increase the value of $$$a_i$$$ by $$$leftlfloorfrac{a_i}{x} ight floor$$$ (i.e. ...
1,600
false
true
false
true
false
false
false
false
false
false
2,449
1620G
For a sequence of strings $$$[t_1, t_2, dots, t_m]$$$, let's define the function $$$f([t_1, t_2, dots, t_m])$$$ as the number of different strings (including the empty string) that are subsequences of at least one string $$$t_i$$$. $$$f([]) = 0$$$ (i.u2009e. the number of such strings for an empty sequence is $$$0$$$)....
2,400
false
false
false
true
false
false
false
false
false
false
2,521
372D
There is a tree consisting of _n_ vertices. The vertices are numbered from 1 to _n_. Let's define the length of an interval [_l_,u2009_r_] as the value _r_u2009-u2009_l_u2009+u20091. The score of a subtree of this tree is the maximum length of such an interval [_l_,u2009_r_] that, the vertices with numbers _l_,u2009_l_...
2,600
false
false
false
false
true
false
false
true
false
false
8,340
240F
A boy named Leo doesn't miss a single TorCoder contest round. On the last TorCoder round number 100666 Leo stumbled over the following problem. He was given a string _s_, consisting of _n_ lowercase English letters, and _m_ queries. Each query is characterised by a pair of integers _l__i_,u2009_r__i_ (1u2009≤u2009_l__i...
2,600
false
false
false
false
true
false
false
false
false
false
8,876
1349F2
Note that the only differences between easy and hard versions are the constraints on $$$n$$$ and the time limit. You can make hacks only if all versions are solved. Slime is interested in sequences. He defined good positive integer sequences $$$p$$$ of length $$$n$$$ as follows: For each $$$k>1$$$ that presents in $$$...
3,500
true
false
false
true
false
false
false
false
false
false
3,958
802B
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 - solve these problems in the archive. If you just want to solve some problem from a contest, a virtu...
1,800
false
true
false
false
true
false
false
false
false
false
6,566
847D
A new dog show on TV is starting next week. On the show dogs are required to demonstrate bottomless stomach, strategic thinking and self-preservation instinct. You and your dog are invited to compete with other participants and naturally you want to win! On the show a dog needs to eat as many bowls of dog food as possi...
2,200
false
true
false
false
true
true
false
false
false
false
6,368
432E
You have an _n_u2009×u2009_m_ rectangle table, its cells are not initially painted. Your task is to paint all cells of the table. The resulting picture should be a tiling of the table with squares. More formally: each cell must be painted some color (the colors are marked by uppercase Latin letters); we will assume t...
2,300
false
true
false
false
false
true
false
false
false
false
8,110
630B
Problem - 630B - Codeforces =============== xa0 ]( "Experimental Educational Round: VolBIT Formulas Blitz") and _t_ (0u2009≤u2009_t_u2009≤u20092xa0000xa0000xa0000)xa0— the number of transistors in the initial time and the number of seconds passed since the initial time. Output Output one number...
1,200
true
false
false
false
false
false
false
false
false
false
7,303
1925D
There are $$$n$$$ children in a class, $$$m$$$ pairs among them are friends. The $$$i$$$-th pair who are friends have a friendship value of $$$f_i$$$. The teacher has to go for $$$k$$$ excursions, and for each of the excursions she chooses a pair of children randomly, equiprobably and independently. If a pair of childr...
1,900
true
false
false
true
false
false
false
false
false
false
738
1968D
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 943 (Div. 3) 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,300
true
true
false
false
false
false
true
false
false
true
497
1809B
You are given a two-dimensional plane, and you need to place $$$n$$$ chips on it. You can place a chip only at a point with integer coordinates. The cost of placing a chip at the point $$$(x, y)$$$ is equal to $$$x + y$$$ (where $$$a$$$ is the absolute value of $$$a$$$). The cost of placing $$$n$$$ chips is equal to th...
1,000
true
true
false
false
false
false
false
true
false
false
1,419