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
1903C
Theofanis easily gets obsessed with problems before going to sleep and often has nightmares about them. To deal with his obsession he visited his doctor, Dr. Emix. In his latest nightmare, he has an array $$$a$$$ of size $$$n$$$ and wants to divide it into non-empty subarrays$$$^{dagger}$$$ such that every element is i...
1,400
false
true
false
false
false
true
false
false
false
false
895
1208E
You are given $$$n$$$ arrays that can have different sizes. You also have a table with $$$w$$$ columns and $$$n$$$ rows. The $$$i$$$-th array is placed horizontally in the $$$i$$$-th row. You can slide each array within its row as long as it occupies several consecutive cells and lies completely inside the table. You n...
2,200
false
false
true
false
true
false
false
false
false
false
4,650
476D
Dreamoon likes to play with sets, integers and . is defined as the largest positive integer that divides both _a_ and _b_. Let _S_ be a set of exactly four distinct integers greater than 0. Define _S_ to be of rank _k_ if and only if for all pairs of distinct elements _s__i_, _s__j_ from _S_, . Given _k_ and _n_, Dream...
1,900
true
true
false
false
false
true
false
false
false
false
7,925
1411B
Problem - 1411B - Codeforces =============== xa0 and Technocup 2021 — Elimination Round 3") Editorial") , but $$$282$$$ is not, because it isn't divisible by $$$8$$$. Given a positive integer $$$n$$$. Find the minimum integer $$$x$$$, such that $$$n leq x$$$ and $$$x$$$ is fair. Input The first line conta...
1,000
false
false
false
false
false
false
true
false
false
false
3,620
1799D2
This is a hard version of the problem. The constraints of $$$t$$$, $$$n$$$, $$$k$$$ are the only difference between versions. You have a device with two CPUs. You also have $$$k$$$ programs, numbered $$$1$$$ through $$$k$$$, that you can run on the CPUs. The $$$i$$$-th program ($$$1 le i le k$$$) takes $$$cold_i$$$ sec...
2,100
false
false
false
true
true
false
false
false
false
false
1,480
1375C
# Element Extermination Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes You are given an array a of length n, which initially is a permutation of numbers from 1 to n. In one operation, you can choose an index i (1 ≤ i < n ) such that ai < a i+1 , and remove ei...
1,400
false
true
false
false
true
true
false
false
false
false
3,785
440A
Problem - 440A - Codeforces =============== xa0 xa0— the number of episodes in a season. Assume that the episodes are numbered by integers from 1 to _n_. The second line contains _n_u2009-u20091 integer _a_1,u2009_a_2,u2009...,u2009_a__n_ (1u2009≤u2009_a__i_u2009≤u2009_n_)xa0— the numbers of episodes that Pol...
800
false
false
true
false
false
false
false
false
false
false
8,079
1891C
A boy called Smilo is playing a new game! In the game, there are $$$n$$$ hordes of monsters, and the $$$i$$$-th horde contains $$$a_i$$$ monsters. The goal of the game is to destroy all the monsters. To do this, you have two types of attacks and a combo counter $$$x$$$, initially set to $$$0$$$: The first type: you ch...
1,500
false
true
false
false
false
true
false
true
true
false
955
954G
Today you are going to lead a group of elven archers to defend the castle that is attacked by an army of angry orcs. Three sides of the castle are protected by impassable mountains and the remaining side is occupied by a long wall that is split into _n_ sections. At this moment there are exactly _a__i_ archers located ...
2,000
false
true
false
false
true
false
false
true
false
false
5,903
884B
A one-dimensional Japanese crossword can be represented as a binary string of length _x_. An encoding of this crossword is an array _a_ of size _n_, where _n_ is the number of segments formed completely of 1's, and _a__i_ is the length of _i_-th segment. No two segments touch or intersect. For example: If _x_u2009=u20...
1,100
false
false
true
false
false
false
false
false
false
false
6,213
887F
During the final part of fashion show all models come to the stage and stay in one row and fashion designer stays to right to model on the right. During the rehearsal, Izabella noticed, that row isn't nice, but she can't figure out how to fix it. Like many other creative people, Izabella has a specific sense of beauty....
2,500
false
true
false
false
false
false
false
false
true
false
6,197
1090L
, # Problem A. Berland University Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 512 megabytes There are t students studying in the best university of Berland. They only study programming in Berland, so there is only one subject. Each student must attend the lectures. The ...
2,000
true
true
false
false
false
false
false
false
false
false
5,261
629D
As you know, every birthday party has a cake! This time, Babaei is going to prepare the very special birthday party's cake. Simple cake is a cylinder of some radius and height. The volume of the simple cake is equal to the volume of corresponding cylinder. Babaei has _n_ simple cakes and he is going to make a special c...
2,000
false
false
false
true
true
false
false
false
false
false
7,306
292E
We often have to copy large volumes of information. Such operation can take up many computer resources. Therefore, in this problem you are advised to come up with a way to copy some part of a number array into another one, quickly. More formally, you've got two arrays of integers _a_1,u2009_a_2,u2009...,u2009_a__n_ and...
1,900
false
false
false
false
true
false
false
false
false
false
8,662
724E
There are _n_ cities located along the one-way road. Cities are numbered from 1 to _n_ in the direction of the road. The _i_-th city had produced _p__i_ units of goods. No more than _s__i_ units of goods can be sold in the _i_-th city. For each pair of cities _i_ and _j_ such that 1u2009≤u2009_i_u2009<u2009_j_u2009≤u20...
2,900
false
true
false
true
false
false
false
false
false
false
6,910
1718B
In all schools in Buryatia, in the $$$1$$$ class, everyone is told the theory of Fibonacci strings. "A block is a subsegment of a string where all the letters are the same and are bounded on the left and right by the ends of the string or by letters other than the letters in the block. A string is called a Fibonacci st...
2,000
true
true
true
false
false
false
false
false
false
false
1,973
1015F
You are given a bracket sequence $$$s$$$ (not necessarily a regular one). A bracket sequence is a string containing only characters '(' and ')'. A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters '1' and '+' between the original characte...
2,300
false
false
false
true
false
false
false
false
false
false
5,613
2041A
Problem - 2041A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,300
false
false
true
false
false
false
false
false
true
false
13
1408C
There is a road with length $$$l$$$ meters. The start of the road has coordinate $$$0$$$, the end of the road has coordinate $$$l$$$. There are two cars, the first standing at the start of the road and the second standing at the end of the road. They will start driving simultaneously. The first car will drive from the ...
1,500
true
false
true
true
false
false
false
true
false
false
3,634
957A
Overlooking the captivating blend of myriads of vernal hues, Arkady the painter lays out a long, long canvas. Arkady has a sufficiently large amount of paint of three colours: cyan, magenta, and yellow. On the one-dimensional canvas split into _n_ consecutive segments, each segment needs to be painted in one of the col...
1,300
false
false
true
false
false
false
false
false
false
false
5,894
416C
Innovation technologies are on a victorious march around the planet. They integrate into all spheres of human activity! A restaurant called "Dijkstra's Place" has started thinking about optimizing the booking system. There are _n_ booking requests received by now. Each request is characterized by two numbers: _c__i_ an...
1,600
false
true
true
true
false
false
false
true
false
false
8,160
1787I
Define the beauty value of a sequence $$$b_1,b_2,ldots,b_c$$$ as the maximum value of $$$sumlimits_{i=1}^{q}b_i + sumlimits_{i=s}^{t}b_i$$$, where $$$q$$$, $$$s$$$, $$$t$$$ are all integers and $$$s > q$$$ or $$$tleq q$$$. Note that $$$b_i = 0$$$ when $$$i<1$$$ or $$$i>c$$$, $$$sumlimits_{i=s}^{t}b_i = 0$$$ when $$$s>t...
3,400
false
false
false
false
true
false
false
false
false
false
1,555
1906A
You are playing a word puzzle. The puzzle starts with a $$$3$$$ by $$$3$$$ grid, where each cell contains either the letter A, B, or C. The goal of this puzzle is to find the lexicographically smallest possible word of length $$$3$$$. The word can be formed by choosing three different cells where the cell containing th...
1,000
false
false
false
false
false
false
true
false
false
false
877
238C
You must have heard of the two brothers dreaming of ruling the world. With all their previous plans failed, this time they decided to cooperate with each other in order to rule the world. As you know there are _n_ countries in the world. These countries are connected by _n_u2009-u20091 directed roads. If you don't cons...
2,100
false
true
false
true
false
false
false
false
false
false
8,882
388A
Fox Ciel has _n_ boxes in her room. They have the same size and weight, but they might have different strength. The _i_-th box can hold at most _x__i_ boxes on its top (we'll call _x__i_ the strength of the box). Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. ...
1,400
false
true
false
false
false
false
false
false
true
false
8,277
316F3
Smart Beaver became interested in drawing. He draws suns. However, at some point, Smart Beaver realized that simply drawing suns is boring. So he decided to design a program that will process his drawings. You are given a picture drawn by the beaver. It will have two colors: one for the background and one for the suns ...
2,200
false
false
true
false
false
true
false
false
false
false
8,569
1267C
, # Cactus Revenge Input file: standard input Output file: standard output Time limit: 3 seconds Memory limit: 512 megabytes NE(E)RC featured a number of problems in previous years about cactuses — connected undirected graphs in which every edge belongs to at most one simple cycle. Intuitively, a cactus is a general...
3,500
false
false
false
false
false
true
false
false
false
false
4,361
1676A
A ticket is a string consisting of six digits. A ticket is considered lucky if the sum of the first three digits is equal to the sum of the last three digits. Given a ticket, output if it is lucky or not. Note that a ticket can have leading zeroes. Input The first line of the input contains an integer $$$t$$$ ($$$1 leq...
800
false
false
true
false
false
false
false
false
false
false
2,215
188G
Problem - 188G - Codeforces =============== xa0 — the size of the array. The following _n_ lines contain the elements of the array, one per line. Each element of the array is an integer between 1 and 100, inclusive. The array might contain duplicate elements. Output Output space-separated elements of the ...
1,600
false
false
true
false
false
false
false
false
false
false
9,086
1689A
Kuznecov likes art, poetry, and music. And strings consisting of lowercase English letters. Recently, Kuznecov has found two strings, $$$a$$$ and $$$b$$$, of lengths $$$n$$$ and $$$m$$$ respectively. They consist of lowercase English letters and no character is contained in both strings. Let another string $$$c$$$ be i...
800
false
true
true
false
false
false
true
false
true
false
2,148
1650G
Given an undirected connected graph with $$$n$$$ vertices and $$$m$$$ edges. The graph contains no loops (edges from a vertex to itself) and multiple edges (i.e. no more than one edge between each pair of vertices). The vertices of the graph are numbered from $$$1$$$ to $$$n$$$. Find the number of paths from a vertex $...
2,100
false
false
false
true
true
false
false
false
false
true
2,369
467B
After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3». The game has (_m_u2009+u20091) players and _n_ types of soldiers in total. Players «Call of Soldiers 3» are numbered form 1 to (_m_u2009+u20091). Types of soldiers are numbered f...
1,100
false
false
true
false
false
true
true
false
false
false
7,971
1873H
Marcel and Valeriu are in the mad city, which is represented by $$$n$$$ buildings with $$$n$$$ two-way roads between them. Marcel and Valeriu start at buildings $$$a$$$ and $$$b$$$ respectively. Marcel wants to catch Valeriu, in other words, be in the same building as him or meet on the same road. During each move, the...
1,700
false
false
false
false
false
false
false
false
false
true
1,037
407D
Problem - 407D - 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
8,195
321E
Fox Ciel is in the Amusement Park. And now she is in a queue in front of the Ferris wheel. There are _n_ people (or foxes more precisely) in the queue: we use first people to refer one at the head of the queue, and _n_-th people to refer the last one in the queue. There will be _k_ gondolas, and the way we allocate gon...
2,600
false
false
false
true
true
false
false
false
false
false
8,547
1175G
Problem - 1175G - 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,000
false
false
false
true
true
false
false
false
false
false
4,839
1569A
You are given a string $$$s$$$, consisting of $$$n$$$ letters, each letter is either 'a' or 'b'. The letters in the string are numbered from $$$1$$$ to $$$n$$$. $$$s[l; r]$$$ is a continuous substring of letters from index $$$l$$$ to $$$r$$$ of the string inclusive. A string is called balanced if the number of letters ...
800
false
false
true
false
false
false
false
false
false
false
2,798
788A
Problem - 788A - 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
true
false
false
false
false
false
false
6,621
526B
Om Nom is the main character of a game "Cut the Rope". He is a bright little monster who likes visiting friends living at the other side of the park. However the dark old parks can scare even somebody as fearless as Om Nom, so he asks you to help him. The park consists of 2_n_u2009+u20091u2009-u20091 squares connected ...
1,400
false
true
true
false
false
false
false
false
false
false
7,730
1921A
Problem - 1921A - 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
true
false
false
false
false
false
false
false
false
765
1974C
Polycarp was given an array $$$a$$$ of $$$n$$$ integers. He really likes triples of numbers, so for each $$$j$$$ ($$$1 le j le n - 2$$$) he wrote down a triple of elements $$$[a_j, a_{j + 1}, a_{j + 2}]$$$. Polycarp considers a pair of triples $$$b$$$ and $$$c$$$ beautiful if they differ in exactly one position, that i...
1,400
false
false
false
false
true
false
false
false
false
false
447
1196D1
The only difference between easy and hard versions is the size of the input. You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'. You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ...
1,500
false
false
true
false
false
false
false
false
false
false
4,719
793E
Earlier, when there was no Internet, each bank had a lot of offices all around Bankopolis, and it caused a lot of problems. Namely, each day the bank had to collect cash from all the offices. Once Oleg the bank client heard a dialogue of two cash collectors. Each day they traveled through all the departments and office...
2,900
false
false
false
true
false
true
false
false
false
false
6,603
2020D
One fine evening, Alice sat down to play the classic game "Connect the Dots", but with a twist. To play the game, Alice draws a straight line and marks $$$n$$$ points on it, indexed from $$$1$$$ to $$$n$$$. Initially, there are no arcs between the points, so they are all disjoint. After that, Alice performs $$$m$$$ ope...
1,800
true
false
false
true
false
false
true
false
false
true
149
702C
You are given _n_ points on the straight line — the positions (_x_-coordinates) of the cities and _m_ points on the same line — the positions (_x_-coordinates) of the cellular towers. All towers work in the same way — they provide cellular network for all cities, which are located at the distance which is no more than ...
1,500
false
false
true
false
false
false
false
true
false
false
7,015
1690D
You have a stripe of checkered paper of length $$$n$$$. Each cell is either white or black. What is the minimum number of cells that must be recolored from white to black in order to have a segment of $$$k$$$ consecutive black cells on the stripe? If the input data is such that a segment of $$$k$$$ consecutive black ce...
1,000
false
false
true
false
false
false
false
false
false
false
2,140
1982F
You have an array $$$a$$$ of $$$n$$$ elements. There are also $$$q$$$ modifications of the array. Before the first modification and after each modification, you would like to know the following: What is the minimum length subarray that needs to be sorted in non-decreasing order in order for the array $$$a$$$ to be comp...
2,600
false
false
false
false
true
false
false
true
true
false
391
1841D
Two segments $$$[l_1, r_1]$$$ and $$$[l_2, r_2]$$$ intersect if there exists at least one $$$x$$$ such that $$$l_1 le x le r_1$$$ and $$$l_2 le x le r_2$$$. An array of segments $$$[[l_1, r_1], [l_2, r_2], dots, [l_k, r_k]]$$$ is called beautiful if $$$k$$$ is even, and is possible to split the elements of this array i...
2,000
false
true
false
false
true
false
false
false
true
false
1,242
1391B
Consider a conveyor belt represented using a grid consisting of $$$n$$$ rows and $$$m$$$ columns. The cell in the $$$i$$$-th row from the top and the $$$j$$$-th column from the left is labelled $$$(i,j)$$$. Every cell, except $$$(n,m)$$$, has a direction R (Right) or D (Down) assigned to it. If the cell $$$(i,j)$$$ is ...
800
false
true
true
false
false
false
true
false
false
false
3,720
1687A
The enchanted forest got its name from the magical mushrooms growing here. They may cause illusions and generally should not be approached. —Perfect Memento in Strict Sense Marisa comes to pick mushrooms in the Enchanted Forest. The Enchanted forest can be represented by $$$n$$$ points on the $$$X$$$-axis numbered $$$1...
1,600
false
true
false
false
false
false
true
false
false
false
2,157
1338B
You have unweighted tree of $$$n$$$ vertices. You have to assign a positive weight to each edge so that the following condition would hold: For every two different leaves $$$v_{1}$$$ and $$$v_{2}$$$ of this tree, }$$$). It's guaranteed that such assignment always exists under given constraints. Now let's define $$$f$$...
1,800
true
true
false
false
false
true
false
false
false
false
4,013
1571D
Kotlin Heroes competition is nearing completion. This time $$$n$$$ programmers took part in the competition. Now organizers are thinking how to entertain spectators as well. One of the possibilities is holding sweepstakes. So for now they decided to conduct a survey among spectators. In total, organizers asked $$$m$$$ ...
1,800
true
false
true
false
false
true
true
false
false
false
2,789
1178B
Problem - 1178B - Codeforces =============== xa0 characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not subsequences: "owoo", "owwwo", "ooo". The wow factor of a string is the number of its su...
1,300
false
false
false
true
false
false
false
false
false
false
4,829
1185C2
The only difference between easy and hard versions is constraints. If you write a solution in Python, then prefer to send it in PyPy to speed up execution time. A session has begun at Beland State University. Many students are taking exams. Polygraph Poligrafovich is going to examine a group of $$$n$$$ students. Studen...
1,700
true
true
false
false
true
false
true
false
false
false
4,777
286A
Problem - 286A - 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,400
true
false
false
false
false
true
false
false
false
false
8,691
345D
A chain letter is a kind of a message which urges the recipient to forward it to as many contacts as possible, usually with some kind of mystic explanation. Of course, this is only a superstition, and you don't believe in it, but all your friends do. You know that today there will be one of these letters going around, ...
2,200
false
false
false
false
false
false
false
false
false
true
8,453
534F
In this task you have to write a program dealing with nonograms on fields no larger than 5u2009×u200920. Simplified nonogram is a task where you have to build such field (each cell is either white or black) that satisfies the given information about rows and columns. For each row and each column the number of contiguou...
2,400
false
false
false
true
false
false
false
false
false
false
7,696
1201D
You are on the island which can be represented as a $$$n imes m$$$ table. The rows are numbered from $$$1$$$ to $$$n$$$ and the columns are numbered from $$$1$$$ to $$$m$$$. There are $$$k$$$ treasures on the island, the $$$i$$$-th of them is located at the position $$$(r_i, c_i)$$$. Initially you stand at the lower l...
2,100
false
true
true
true
false
false
false
true
false
false
4,692
1613D
Let's call a sequence of integers $$$x_1, x_2, dots, x_k$$$ MEX-correct if for all $$$i$$$ ($$$1 le i le k$$$) $$$x_i - operatorname{MEX}(x_1, x_2, dots, x_i) le 1$$$ holds. Where $$$operatorname{MEX}(x_1, dots, x_k)$$$ is the minimum non-negative integer that doesn't belong to the set $$$x_1, dots, x_k$$$. For example...
1,900
true
false
false
true
false
false
false
false
false
false
2,573
1823C
A prime number is an integer greater than $$$1$$$, which has exactly two divisors. For example, $$$7$$$ is a prime, since it has two divisors $$${1, 7}$$$. A composite number is an integer greater than $$$1$$$, which has more than two different divisors. Note that the integer $$$1$$$ is neither prime nor composite. Let...
1,300
true
true
false
false
false
false
false
false
false
false
1,341
1736A
You are given two arrays $$$a$$$ and $$$b$$$ of $$$n$$$ elements, each element is either $$$0$$$ or $$$1$$$. You can make operations of $$$2$$$ kinds. Pick an index $$$i$$$ and change $$$a_i$$$ to $$$1-a_i$$$. Rearrange the array $$$a$$$ however you want. Find the minimum number of operations required to make $$$a$$$...
800
false
true
false
false
false
false
true
false
true
false
1,874
1388C
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index. There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these road...
1,800
true
true
false
false
false
false
false
false
false
false
3,731
1996E
Problem - 1996E - 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
true
false
true
false
false
false
false
false
286
1105A
Salem gave you $$$n$$$ sticks with integer positive lengths $$$a_1, a_2, ldots, a_n$$$. For every stick, you can change its length to any other positive integer length (that is, either shrink or stretch it). The cost of changing the stick's length from $$$a$$$ to $$$b$$$ is $$$a - b$$$, where $$$x$$$ means the absolute...
1,100
false
false
true
false
false
false
true
false
false
false
5,180
1095C
Problem - 1095C - 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,400
false
true
false
false
false
false
false
false
false
false
5,235
2000F
You have $$$n$$$ rectangles, the $$$i$$$-th of which has a width of $$$a_i$$$ and a height of $$$b_i$$$. You can perform the following operation an unlimited number of times: choose a rectangle and a cell in it, and then color it. Each time you completely color any row or column, you earn $$$1$$$ point. Your task is to...
1,900
true
true
true
true
false
false
false
false
false
false
258
34C
«Bersoft» company is working on a new version of its most popular text editor — Bord 2010. Bord, like many other text editors, should be able to print out multipage documents. A user keys a sequence of the document page numbers that he wants to print out (separates them with a comma, without spaces). Your task is to wr...
1,300
false
false
true
false
false
false
false
false
true
false
9,826
1156D
Problem - 1156D - 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
false
false
false
true
false
false
false
false
false
false
4,927
1690E
A batch of $$$n$$$ goods ($$$n$$$xa0— an even number) is brought to the store, $$$i$$$-th of which has weight $$$a_i$$$. Before selling the goods, they must be packed into packages. After packing, the following will be done: There will be $$$frac{n}{2}$$$ packages, each package contains exactly two goods; The weight ...
1,500
true
true
false
false
false
false
false
true
false
false
2,139
1044F
Let $$$T$$$ be a tree on $$$n$$$ vertices. Consider a graph $$$G_0$$$, initially equal to $$$T$$$. You are given a sequence of $$$q$$$ updates, where the $$$i$$$-th update is given as a pair of two distinct integers $$$u_i$$$ and $$$v_i$$$. For every $$$i$$$ from $$$1$$$ to $$$q$$$, we define the graph $$$G_i$$$ as fol...
2,700
false
false
false
false
true
false
false
false
false
false
5,471
303B
You are given a rectangle grid. That grid's size is _n_u2009×u2009_m_. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (_x_,u2009_y_) (0u2009≤u2009_x_u2009≤u2009_n_,u20090u2009≤u2009_y_u2009≤u2009_m_). Your task is to find a maximum sub-rectangle on ...
1,700
true
false
true
false
false
false
false
false
false
false
8,622
1904F
Lunchbox has a tree of size $$$n$$$ rooted at node $$$1$$$. Each node is then assigned a value. Lunchbox considers the tree to be beautiful if each value is distinct and ranges from $$$1$$$ to $$$n$$$. In addition, a beautiful tree must also satisfy $$$m$$$ requirements of $$$2$$$ types: "1 a b c"xa0— The node with th...
2,800
false
false
true
false
true
false
false
false
false
true
884
66A
Little Petya has recently started attending a programming club. Naturally he is facing the problem of choosing a programming language. After long considerations he realized that Java is the best choice. The main argument in favor of choosing Java was that it has a very large integer data type, called BigInteger. But ha...
1,300
false
false
true
false
false
false
false
false
false
false
9,641
808C
Polycarp invited all his friends to the tea party to celebrate the holiday. He has _n_ cups, one for each of his _n_ friends, with volumes _a_1,u2009_a_2,u2009...,u2009_a__n_. His teapot stores _w_ milliliters of tea (_w_u2009≤u2009_a_1u2009+u2009_a_2u2009+u2009...u2009+u2009_a__n_). Polycarp wants to pour tea in cups ...
1,400
false
true
false
false
false
true
false
false
true
false
6,533
1328A
Problem - 1328A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
true
false
false
false
false
false
false
false
false
false
4,071
877C
Slava plays his favorite game "Peace Lightning". Now he is flying a bomber on a very specific map. Formally, map is a checkered field of size 1u2009×u2009_n_, the cells of which are numbered from 1 to _n_, in each cell there can be one or several tanks. Slava doesn't know the number of tanks and their positions, becaus...
1,600
false
false
false
false
false
true
false
false
false
false
6,238
379D
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas). V...
2,000
false
false
false
true
false
false
true
false
false
false
8,314
10D
This problem differs from one which was on the online contest. The sequence _a_1,u2009_a_2,u2009...,u2009_a__n_ is called increasing, if _a__i_u2009<u2009_a__i_u2009+u20091 for _i_u2009<u2009_n_. The sequence _s_1,u2009_s_2,u2009...,u2009_s__k_ is called the subsequence of the sequence _a_1,u2009_a_2,u2009...,u2009_a__...
2,800
false
false
false
true
false
false
false
false
false
false
9,942
245G
Polycarpus works as a programmer in a start-up social network. His boss gave his a task to develop a mechanism for determining suggested friends. Polycarpus thought much about the task and came to the folowing conclusion. Let's say that all friendship relationships in a social network are given as _m_ username pairs _a...
2,200
false
false
false
false
false
false
true
false
false
true
8,850
1730E
You are given an array $$$a_1, a_2, ldots, a_n$$$ of positive integers. Find the number of pairs of indices $$$(l, r)$$$, where $$$1 le l le r le n$$$, that pass the check. The check is performed in the following manner: 1. The minimum and maximum numbers are found among $$$a_l, a_{l+1}, ldots, a_r$$$. 2. The check is ...
2,700
false
false
false
false
true
false
false
false
false
false
1,907
152A
Vasya, or Mr. Vasily Petrov is a dean of a department in a local university. After the winter exams he got his hands on a group's gradebook. Overall the group has _n_ students. They received marks for _m_ subjects. Each student got a mark from 1 to 9 (inclusive) for each subject. Let's consider a student the best at so...
900
false
false
true
false
false
false
false
false
false
false
9,269
1203F1
The only difference between easy and hard versions is that you should complete all the projects in easy version but this is not necessary in hard version. Polycarp is a very famous freelancer. His current rating is $$$r$$$ units. Some very rich customers asked him to complete some projects for their companies. To compl...
2,100
false
true
false
false
false
false
false
false
false
false
4,677
1608D
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet. The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 le i le n$$$ the ...
2,400
true
false
false
false
false
false
false
false
false
true
2,612
1950A
Problem - 1950A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
false
false
true
false
false
false
false
false
false
false
581
1446D1
This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array $$$[a_1, a_2, dots, a_n]$$$. Your goal is to find the length of the longest subarray of this array such that...
2,600
false
true
false
false
true
false
false
false
false
false
3,444
1916D
The mathematicians of the 31st lyceum were given the following task: You are given an odd number $$$n$$$, and you need to find $$$n$$$ different numbers that are squares of integers. But it's not that simple. Each number should have a length of $$$n$$$ (and should not have leading zeros), and the multiset of digits of ...
1,700
true
false
false
false
false
true
true
false
false
false
800
1991D
You are given an undirected graph with $$$n$$$ vertices, numbered from $$$1$$$ to $$$n$$$. There is an edge between vertices $$$u$$$ and $$$v$$$ if and only if $$$u oplus v$$$ is a . The description of test cases follows. The only line contains a single integer $$$n$$$ ($$$1 le n le 2 cdot 10^5$$$)xa0— the number of ve...
1,900
true
true
false
false
false
true
false
false
false
true
325
1385F
You are given a tree (connected graph without cycles) consisting of $$$n$$$ vertices. The tree is unrooted — it is just a connected undirected graph without cycles. In one move, you can choose exactly $$$k$$$ leaves (leaf is such a vertex that is connected to only one another vertex) connected to the same vertex and re...
2,300
false
true
true
false
true
false
false
false
false
false
3,742
544B
A map of some object is a rectangular field consisting of _n_ rows and _n_ columns. Each cell is initially occupied by the sea but you can cover some some cells of the map with sand so that exactly _k_ islands appear on the map. We will call a set of sand cells to be island if it is possible to get from each of them to...
1,400
false
false
true
false
false
true
false
false
false
false
7,663
1846B
Problem - 1846B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
false
false
true
false
false
false
true
false
false
false
1,207
920B
Recently _n_ students from city S moved to city P to attend a programming camp. They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea. _i_-th stu...
1,200
false
false
true
false
false
false
false
false
false
false
6,049
1965E
There are $$$n cdot m$$$ unit cubes currently in positions $$$(1, 1, 1)$$$ through $$$(n, m, 1)$$$. Each of these cubes is one of $$$k$$$ colors. You want to add additional cubes at any integer coordinates such that the subset of cubes of each color is connected, where two cubes are considered connected if they share a...
3,100
false
false
false
false
false
true
false
false
false
false
512
1255C
Bob is an avid fan of the video game "League of Leesins", and today he celebrates as the League of Leesins World Championship comes to an end! The tournament consisted of $$$n$$$ ($$$n ge 5$$$) teams around the world. Before the tournament starts, Bob has made a prediction of the rankings of each team, from $$$1$$$-st ...
1,600
false
false
true
false
false
true
false
false
false
false
4,408
461E
Appleman and Toastman like games. Today they play a game with strings with the following rules. Firstly Toastman tells Appleman two strings _s_ and _t_ both consisting only of letters 'A', 'B', 'C', 'D'. Then Appleman must build string _s_ as quickly as possible. Initially he has empty string, and in one second he can ...
3,000
false
false
false
false
false
false
false
true
false
false
7,992
1541A
There are $$$n$$$ cats in a line, labeled from $$$1$$$ to $$$n$$$, with the $$$i$$$-th cat at position $$$i$$$. They are bored of gyrating in the same spot all day, so they want to reorder themselves such that no cat is in the same place as before. They are also lazy, so they want to minimize the total distance they mo...
800
false
true
true
false
false
true
false
false
false
false
2,936
383D
Iahub accidentally discovered a secret lab. He found there _n_ devices ordered in a line, numbered from 1 to _n_ from left to right. Each device _i_ (1u2009≤u2009_i_u2009≤u2009_n_) can create either _a__i_ units of matter or _a__i_ units of antimatter. Iahub wants to choose some contiguous subarray of devices in the la...
2,300
false
false
false
true
false
false
false
false
false
false
8,295
1882E1
This is the easy version of the problem. The difference between the two versions is that you do not have to minimize the number of operations in this version. You can make hacks only if both versions of the problem are solved. You have two permutations$$$^{dagger}$$$ $$$p_{1}, p_{2}, ldots, p_{n}$$$ (of integers $$$1$$...
2,400
false
true
false
false
false
true
true
false
false
false
993
41C
Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gmail.com). It is known that a proper email address contains only such symbols as ...
1,300
false
false
true
false
false
false
false
false
false
false
9,782
197B
Problem - 197B - 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,400
true
false
false
false
false
false
false
false
false
false
9,052
1371E2
# Asterism (Hard Version) Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes This is the hard version of the problem. The difference between versions is the constraints on n and ai. You can make hacks only if all versions of the problem are solved. First, Aoi c...
2,300
true
false
false
true
false
false
false
true
true
false
3,809