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
1015C
Ivan has $$$n$$$ songs on his phone. The size of the $$$i$$$-th song is $$$a_i$$$ bytes. Ivan also has a flash drive which can hold at most $$$m$$$ bytes in total. Initially, his flash drive is empty. Ivan wants to copy all $$$n$$$ songs to the flash drive. He can compress the songs. If he compresses the $$$i$$$-th son...
1,100
false
false
false
false
false
false
false
false
true
false
5,617
1985B
Problem - 1985B - 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
373
1000G
You are given a weighted tree (undirected connected graph with no cycles, loops or multiple edges) with $$$n$$$ vertices. The edge $$${u_j, v_j}$$$ has weight $$$w_j$$$. Also each vertex $$$i$$$ has its own value $$$a_i$$$ assigned to it. Let's call a path starting in vertex $$$u$$$ and ending in vertex $$$v$$$, where ...
2,700
false
false
false
true
true
false
false
false
false
false
5,699
678E
The rules of Sith Tournament are well known to everyone. _n_ Sith take part in the Tournament. The Tournament starts with the random choice of two Sith who will fight in the first battle. As one of them loses, his place is taken by the next randomly chosen Sith who didn't fight before. Does it need to be said that each...
2,200
true
false
false
true
false
false
false
false
false
false
7,112
166D
The warehouse in your shop has _n_ shoe pairs. Each pair is characterized by two integers: its price _c__i_ and its size _s__i_. We know that on this very day all numbers _s__i_ are different, that is, there is no more than one pair of each size. The shop has _m_ customers who came at the same time. The customer number...
2,500
false
true
false
true
false
false
false
false
true
false
9,197
1678B1
This is the easy version of the problem. The only difference between the two versions is that the harder version asks additionally for a minimum number of subsegments. Tokitsukaze has a binary string $$$s$$$ of length $$$n$$$, consisting only of zeros and ones, $$$n$$$ is even. Now Tokitsukaze divides $$$s$$$ into the ...
800
false
false
true
false
false
false
false
false
false
false
2,199
1693A
We have an array of length $$$n$$$. Initially, each element is equal to $$$0$$$ and there is a pointer located on the first element. We can do the following two kinds of operations any number of times (possibly zero) in any order: 1. If the pointer is not on the last element, increase the element the pointer is current...
1,300
false
true
false
false
false
false
false
false
false
false
2,122
215D
The official capital and the cultural capital of Berland are connected by a single road running through _n_ regions. Each region has a unique climate, so the _i_-th (1u2009≤u2009_i_u2009≤u2009_n_) region has a stable temperature of _t__i_ degrees in summer. This summer a group of _m_ schoolchildren wants to get from th...
1,900
false
true
false
false
false
false
false
false
false
false
8,978
479D
Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! However, there is no reason for disappointment, as Valery has found another ruler, its length is _l_ centimeters. The ruler already has _n_ marks, with which he can make measu...
1,700
false
true
true
false
false
false
false
true
false
false
7,913
2008H
Sakurako will soon take a test. The test can be described as an array of integers $$$n$$$ and a task on it: Given an integer $$$x$$$, Sakurako can perform the following operation any number of times: Choose an integer $$$i$$$ ($$$1le ile n$$$) such that $$$a_ige x$$$; Change the value of $$$a_i$$$ to $$$a_i-x$$$. Usi...
2,100
true
true
false
false
false
false
true
true
false
false
201
329A
You are an adventurer currently journeying inside an evil temple. After defeating a couple of weak zombies, you arrived at a square room consisting of tiles forming an _n_u2009×u2009_n_ grid. The rows are numbered 1 through _n_ from top to bottom, and the columns are numbered 1 through _n_ from left to right. At the fa...
1,500
false
true
false
false
false
true
false
false
false
false
8,529
1360G
# A/B Matrix Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes You are given four positive integers n, m, a, b (1 ≤ b ≤ n ≤ 50 ; 1 ≤ a ≤ m ≤ 50 ). Find any such rectangular matrix of size n × m that satisfies all of the following conditions: • each row of the ...
1,900
true
true
false
false
false
true
false
false
false
false
3,879
1406B
You are given an array of integers $$$a_1,a_2,ldots,a_n$$$. Find the maximum possible value of $$$a_ia_ja_ka_la_t$$$ among all five indices $$$(i, j, k, l, t)$$$ ($$$i<j<k<l<t$$$). Input The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1le tle 2 cdot 10^4$$$) — the number of tes...
1,200
false
true
true
true
false
false
true
false
true
false
3,645
843B
This is an interactive problem. You are given a sorted in increasing order singly linked list. You should find the minimum integer in the list which is greater than or equal to _x_. More formally, there is a singly liked list built on an array of _n_ elements. Element with index _i_ contains two integers: _value__i_ is...
2,000
false
false
false
false
false
false
true
false
false
false
6,390
1800C2
This is a hard version of the problem. It differs from the easy one only by constraints on $$$n$$$ and $$$t$$$. There is a deck of $$$n$$$ cards, each of which is characterized by its power. There are two types of cards: a hero card, the power of such a card is always equal to $$$0$$$; a bonus card, the power of such...
1,100
false
true
false
false
true
false
false
false
false
false
1,472
789B
Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression _b_ defined by two integers _b_1 and _q_. Remind that a geometric progression is a sequence of integers _b_1,u2009_b_2,u2009_b_3,u2009..., where for each _i_u2009>u20091 the respective t...
1,700
true
false
true
false
false
false
true
false
false
false
6,615
1976E
Initially, we had one array, which was a permutation of size $$$n$$$ (an array of size $$$n$$$ where each integer from $$$1$$$ to $$$n$$$ appears exactly once). We performed $$$q$$$ operations. During the $$$i$$$-th operation, we did the following: choose any array we have with at least $$$2$$$ elements; split it int...
2,500
true
true
false
false
true
false
false
false
false
false
429
1051D
Problem - 1051D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,700
false
false
false
true
false
false
false
false
false
false
5,452
1084B
The Fair Nut likes kvass very much. On his birthday parents presented him $$$n$$$ kegs of kvass. There are $$$v_i$$$ liters of kvass in the $$$i$$$-th keg. Each keg has a lever. You can pour your glass by exactly $$$1$$$ liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by...
1,200
false
true
true
false
false
false
false
false
false
false
5,301
1425A
Lately, Mr. Chanek frequently plays the game Arena of Greed. As the name implies, the game's goal is to find the greediest of them all, who will then be crowned king of Compfestnesia. The game is played by two people taking turns, where Mr. Chanek takes the first turn. Initially, there is a treasure chest containing $$...
1,400
false
true
false
false
false
false
false
false
false
false
3,547
1368H1
# Breadboard Capacity (easy version) Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 512 megabytes This is an easier version of the problem H without modification queries. Lester and Delbert work at an electronics company. They are currently working on a microchip compon...
3,300
false
true
false
true
false
false
false
false
false
false
3,829
1462C
Problem - 1462C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
900
true
true
false
false
false
false
true
false
false
false
3,378
482C
You play the game with your friend. The description of this game is listed below. Your friend creates _n_ distinct strings of the same length _m_ and tells you all the strings. Then he randomly chooses one of them. He chooses strings equiprobably, i.e. the probability of choosing each of the _n_ strings equals . You wa...
2,600
false
false
false
true
false
false
false
false
false
false
7,907
57B
Chris the Rabbit found the traces of an ancient Martian civilization. The brave astronomer managed to see through a small telescope an architecture masterpiece — "A Road to the Sun". The building stands on cubical stones of the same size. The foundation divides the entire "road" into cells, into which the cubical stone...
1,600
false
false
true
false
false
false
false
false
false
false
9,689
401A
Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only limit is, the number on each card doesn't exceed _x_ in the absolute value. Natasha doesn't like when Vanya spends a long time pl...
800
true
false
true
false
false
false
false
false
false
false
8,222
1999A
Problem - 1999A - 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
true
false
false
false
false
false
false
false
271
864F
There are _n_ cities in Berland. Some pairs of them are connected with _m_ directed roads. One can use only these roads to move from one city to another. There are no roads that connect a city to itself. For each pair of cities (_x_,u2009_y_) there is at most one road from _x_ to _y_. A path from city _s_ to city _t_ i...
2,700
false
false
false
false
false
false
false
false
false
true
6,282
2006D
Iris has just learned multiplication in her Maths lessons. However, since her brain is unable to withstand too complex calculations, she could not multiply two integers with the product greater than $$$k$$$ together. Otherwise, her brain may explode! Her teacher sets a difficult task every day as her daily summer holid...
2,600
true
true
true
false
true
false
false
false
false
false
214
1650F
Vitaly enrolled in the course Advanced Useless Algorithms. The course consists of $$$n$$$ tasks. Vitaly calculated that he has $$$a_i$$$ hours to do the task $$$i$$$ from the day he enrolled in the course. That is, the deadline before the $$$i$$$-th task is $$$a_i$$$ hours. The array $$$a$$$ is sorted in ascending orde...
2,200
false
true
true
true
false
false
false
false
false
false
2,370
1114D
You are given a line of $$$n$$$ colored squares in a row, numbered from $$$1$$$ to $$$n$$$ from left to right. The $$$i$$$-th square initially has the color $$$c_i$$$. Let's say, that two squares $$$i$$$ and $$$j$$$ belong to the same connected component if $$$c_i = c_j$$$, and $$$c_i = c_k$$$ for all $$$k$$$ satisfyin...
1,900
false
false
false
true
false
false
false
false
false
false
5,131
1736D
Everool has a binary string $$$s$$$ of length $$$2n$$$. Note that a binary string is a string consisting of only characters $$$0$$$ and $$$1$$$. He wants to partition $$$s$$$ into two disjoint equal subsequences. He needs your help to do it. You are allowed to do the following operation exactly once. You can choose an...
2,200
false
true
true
false
false
true
false
false
false
false
1,870
1223A
Let's denote correct match equation (we will denote it as CME) an equation $$$a + b = c$$$ there all integers $$$a$$$, $$$b$$$ and $$$c$$$ are greater than zero. For example, equations $$$2 + 2 = 4$$$ (+=) and $$$1 + 2 = 3$$$ (+=) are CME but equations $$$1 + 2 = 4$$$ (+=), $$$2 + 2 = 3$$$ (+=), and $$$0 + 1 = 1$$$ (+=...
800
true
false
false
false
false
false
false
false
false
false
4,559
27B
The tournament «Sleepyhead-2010» in the rapid falling asleep has just finished in Berland. _n_ best participants from the country have participated in it. The tournament consists of games, each of them is a match between two participants. _n_·(_n_u2009-u20091)u2009/u20092 games were played during the tournament, and ea...
1,300
false
true
false
false
false
false
true
false
false
false
9,862
1770G
Chiyuu has a bracket sequence$$$^dagger$$$ $$$s$$$ of length $$$n$$$. Let $$$k$$$ be the minimum number of characters that Chiyuu has to remove from $$$s$$$ to make $$$s$$$ balanced$$$^ddagger$$$. Now, Koxia wants you to count the number of ways to remove $$$k$$$ characters from $$$s$$$ so that $$$s$$$ becomes balanced...
3,400
true
false
false
false
false
false
false
false
false
false
1,671
2038L
Problem - 2038L - 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
true
true
false
true
false
false
true
false
false
false
27
302A
Problem - 302A - 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
8,625
1852D
Miriany's matchstick is a $$$2 imes n$$$ grid that needs to be filled with characters A or B. He has already filled in the first row of the grid and would like you to fill in the second row. You must do so in a way such that the number of adjacent pairs of cells with different characters$$$^dagger$$$ is equal to $$$k$...
2,800
false
true
false
true
false
true
false
false
false
false
1,164
1137A
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
1,600
false
false
true
false
false
false
false
false
true
false
5,042
1555B
You have an axis-aligned rectangle room with width $$$W$$$ and height $$$H$$$, so the lower left corner is in point $$$(0, 0)$$$ and the upper right corner is in $$$(W, H)$$$. There is a rectangular table standing in this room. The sides of the table are parallel to the walls, the lower left corner is in $$$(x_1, y_1)$...
1,300
false
false
false
false
false
false
true
false
false
false
2,860
165D
Let's define a non-oriented connected graph of _n_ vertices and _n_u2009-u20091 edges as a beard, if all of its vertices except, perhaps, one, have the degree of 2 or 1 (that is, there exists no more than one vertex, whose degree is more than two). Let us remind you that the degree of a vertex is the number of edges th...
2,100
false
false
false
false
true
false
false
false
false
false
9,202
1411E
You've got a string $$$S$$$ consisting of $$$n$$$ lowercase English letters from your friend. It turned out that this is a number written in poman numerals. The poman numeral system is long forgotten. All that's left is the algorithm to transform number from poman numerals to the numeral system familiar to us. Characte...
2,300
true
true
false
false
false
false
false
false
false
false
3,617
1375H
You are given a permutation $$$a_1, a_2, dots, a_n$$$ of numbers from $$$1$$$ to $$$n$$$. Also, you have $$$n$$$ sets $$$S_1,S_2,dots, S_n$$$, where $$$S_i={a_i}$$$. Lastly, you have a variable $$$cnt$$$, representing the current number of sets. Initially, $$$cnt = n$$$. We define two kinds of functions on sets: $$$f(S...
3,300
false
false
false
false
false
true
false
false
false
false
3,780
188C
Problem - 188C - Codeforces =============== xa0 of two numbers is the smallest positive integer which is divisible by both of them. You are given integers _a_ and _b_. Calculate their LCM. Input The input contains two integers _a_ and _b_ (1u2009≤u2009_a_,u2009_b_u2009≤u2009103), separated by a single spa...
1,400
true
false
true
false
false
false
false
false
false
false
9,090
1526C2
This is the hard version of the problem. The only difference is that in this version $$$n leq 200000$$$. You can make hacks only if both versions of the problem are solved. There are $$$n$$$ potions in a line, with potion $$$1$$$ on the far left and potion $$$n$$$ on the far right. Each potion will increase your health...
1,600
false
true
false
false
true
false
false
false
false
false
3,033
1631B
You are given an array $$$a$$$ of $$$n$$$ elements. You can apply the following operation to it any number of times: Select some subarray from $$$a$$$ of even size $$$2k$$$ that begins at position $$$l$$$ ($$$1le l le l+2cdot{k}-1le n$$$, $$$k ge 1$$$) and for each $$$i$$$ between $$$0$$$ and $$$k-1$$$ (inclusive), as...
1,100
false
true
false
true
false
false
false
false
false
false
2,459
575C
Note the unusual memory limit for the problem. People working in MDCS (Microsoft Development Center Serbia) like partying. They usually go to night clubs on Friday and Saturday. There are _N_ people working in MDCS and there are _N_ clubs in the city. Unfortunately, if there is more than one Microsoft employee in night...
2,700
false
false
false
false
false
false
true
false
false
false
7,550
1450B
You have $$$n$$$ distinct points $$$(x_1, y_1),ldots,(x_n,y_n)$$$ on the plane and a non-negative integer parameter $$$k$$$. Each point is a microscopic steel ball and $$$k$$$ is the attract power of a ball when it's charged. The attract power is the same for all balls. In one operation, you can select a ball $$$i$$$ t...
1,000
false
true
false
false
false
false
true
false
false
false
3,437
1249B2
The only difference between easy and hard versions is constraints. There are $$$n$$$ kids, each of them is reading a unique book. At the end of any day, the $$$i$$$-th kid will give his book to the $$$p_i$$$-th kid (in case of $$$i = p_i$$$ the kid will give his book to himself). It is guaranteed that all values of $$$...
1,300
true
false
false
false
false
false
false
false
false
false
4,462
1811G1
This is an easy version of the problem, it differs from the hard 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...
2,100
true
false
false
true
false
false
false
false
false
false
1,399
1922C
There are $$$n$$$ cities located on the number line, the $$$i$$$-th city is in the point $$$a_i$$$. The coordinates of the cities are given in ascending order, so $$$a_1 < a_2 < dots < a_n$$$. The distance between two cities $$$x$$$ and $$$y$$$ is equal to $$$a_x - a_y$$$. For each city $$$i$$$, let's define the closes...
1,300
true
true
true
false
false
false
false
false
false
false
756
946C
Problem - 946C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,300
false
true
false
false
false
false
false
false
false
false
5,930
1340C
If the girl doesn't go to Denis, then Denis will go to the girl. Using this rule, the young man left home, bought flowers and went to Nastya. On the way from Denis's house to the girl's house is a road of $$$n$$$ lines. This road can't be always crossed in one green light. Foreseeing this, the good mayor decided to pla...
2,400
false
false
false
true
false
false
false
false
false
true
4,005
1830A
Copil Copac is given a list of $$$n-1$$$ edges describing a tree of $$$n$$$ vertices. He decides to draw it using the following algorithm: Step $$$0$$$: Draws the first vertex (vertex $$$1$$$). Go to step $$$1$$$. Step $$$1$$$: For every edge in the input, in order: if the edge connects an already drawn vertex $$$u$$...
1,400
false
false
false
true
false
false
false
false
false
true
1,306
1696D
A permutation is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is $$$4$$$ in the ar...
1,900
false
true
false
false
true
true
false
true
false
false
2,105
1995E2
This is the hard version of a problem. The only difference between an easy and a hard version is the constraints on $$$t$$$ and $$$n$$$. You can make hacks only if both versions of the problem are solved. Arthur is giving a lesson to his famous $$$2 n$$$ knights. Like any other students, they're sitting at the desks in...
2,900
false
false
false
true
true
false
false
false
false
false
291
34B
Problem - 34B - 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...
900
false
true
false
false
false
false
false
false
true
false
9,827
862B
Problem - 862B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,300
false
false
false
false
false
false
false
false
false
true
6,299
297C
Polar bears like unique arrays — that is, arrays without repeated elements. You have got a unique array _s_ with length _n_ containing non-negative integers. Since you are good friends with Alice and Bob, you decide to split the array in two. Precisely, you need to construct two arrays _a_ and _b_ that are also of leng...
2,400
false
false
false
false
false
true
false
false
false
false
8,642
1364C
# Ehab and Prefix MEXs Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes Given an array a of length n, find another array, b, of length n such that: • for each i (1 ≤ i ≤ n) M EX ({b1, b2, . . . , bi}) = ai.The M EX of a set of integers is the smallest non-nega...
1,600
false
true
false
false
false
true
true
false
false
false
3,860
622A
Problem - 622A - Codeforces =============== xa0 ]( "Educational Codeforces Round 7") . Find the number on the _n_-th position of the sequence. Input The only line contains integer _n_ (1u2009≤u2009_n_u2009≤u20091014) — the position of the number to find. Note that the given number is too large, so you shou...
1,000
true
false
true
false
false
false
false
false
false
false
7,346
1107D
You are given a binary matrix $$$A$$$ of size $$$n imes n$$$. Let's denote an $$$x$$$-compression of the given matrix as a matrix $$$B$$$ of size $$$frac{n}{x} imes frac{n}{x}$$$ such that for every $$$i in [1, n], j in [1, n]$$$ the condition $$$A[i][j] = B[lceil frac{i}{x} ceil][lceil frac{j}{x} ceil]$$$ is met. ...
1,800
true
false
true
true
false
false
false
false
false
false
5,166
42A
Problem - 42A - Codeforces =============== xa0 . This should also improve his algebra skills. According to the borscht recipe it consists of _n_ ingredients that have to be mixed in proportion litres (thus, there should be _a_1u2009·_x_,u2009...,u2009_a__n_u2009·_x_ litres of corresponding ingredients...
1,400
false
true
true
false
false
false
false
false
false
false
9,779
1254B1
This is the easier version of the problem. In this version, $$$1 le n le 10^5$$$ and $$$0 le a_i le 1$$$. You can hack this problem only if you solve and lock both problems. Christmas is coming, and our protagonist, Bob, is preparing a spectacular present for his long-time best friend Alice. This year, he decides to pr...
1,800
true
true
false
false
false
true
false
false
false
false
4,415
870F
Problem - 870F - Codeforces =============== xa0 ") ") be the shortest distance between _u_ and _v_, or 0 if there is no path between them. Compute the sum of values _d_(_u_,u2009_v_) over all 1u2009≤u2009_u_u2009<u2009_v_u2009≤u2009_n_. The _gcd_ (greatest common divisor) of two positive integers is the ma...
2,700
false
false
false
false
true
false
false
false
false
false
6,256
1845B
Bob and Carol hanged out with Alice the whole day, but now it's time to go home. Alice, Bob and Carol live on an infinite 2D grid in cells $$$A$$$, $$$B$$$, and $$$C$$$ respectively. Right now, all of them are in cell $$$A$$$. If Bob (or Carol) is in some cell, he (she) can move to one of the neighboring cells. Two cel...
900
true
false
true
false
false
false
false
false
false
false
1,213
1542A
You are given a multiset (i.xa0e. a set that can contain multiple equal integers) containing $$$2n$$$ integers. Determine if you can split it into exactly $$$n$$$ pairs (i.xa0e. each element should be in exactly one pair) so that the sum of the two elements in each pair is odd (i.xa0e. when divided by $$$2$$$, the rema...
800
true
false
false
false
false
false
false
false
false
false
2,934
632C
Problem - 632C - Codeforces =============== xa0 . Each of the next _n_ lines contains one string _a__i_ (1u2009≤u2009_a__i_u2009≤u200950) consisting of only lowercase English letters. The sum of string lengths will not exceed 5·104. Output Print the only string _a_ — the lexicographically smallest string conc...
1,700
false
false
false
false
false
false
false
false
true
false
7,279
629A
Door's family is going celebrate Famil Doors's birthday party. They love Famil Door so they are planning to make his birthday cake weird! The cake is a _n_u2009×u2009_n_ square consisting of equal squares with side length 1. Each square is either empty or consists of a single chocolate. They bought the cake and randoml...
800
false
false
true
false
false
true
true
false
false
false
7,309
1878C
Aca and Milovan, two fellow competitive programmers, decided to give Vasilije a problem to test his skills. Vasilije is given three positive integers: $$$n$$$, $$$k$$$, and $$$x$$$, and he has to determine if he can choose $$$k$$$ distinct integers between $$$1$$$ and $$$n$$$, such that their sum is equal to $$$x$$$. S...
900
true
false
false
false
false
false
false
false
false
false
1,015
750C
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch...
1,600
true
true
false
false
false
false
false
true
false
false
6,791
261C
Problem - 261C - 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
true
false
true
false
false
false
false
8,788
1076C
Problem - 1076C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,300
true
false
false
false
false
false
false
true
false
false
5,342
1295E
You are given a permutation $$$p_1, p_2, dots , p_n$$$ (an array where each integer from $$$1$$$ to $$$n$$$ appears exactly once). The weight of the $$$i$$$-th element of this permutation is $$$a_i$$$. At first, you separate your permutation into two non-empty sets — prefix and suffix. More formally, the first set cont...
2,200
false
false
false
false
true
false
false
false
false
false
4,219
888F
There are _n_ points marked on the plane. The points are situated in such a way that they form a regular polygon (marked points are its vertices, and they are numbered in counter-clockwise order). You can draw _n_u2009-u20091 segments, each connecting any two marked points, in such a way that all points have to be conn...
2,500
false
false
false
true
false
false
false
false
false
true
6,191
1619D
Vlad has $$$n$$$ friends, for each of whom he wants to buy one gift for the New Year. There are $$$m$$$ shops in the city, in each of which he can buy a gift for any of his friends. If the $$$j$$$-th friend ($$$1 le j le n$$$) receives a gift bought in the shop with the number $$$i$$$ ($$$1 le i le m$$$), then the frie...
1,800
false
true
false
false
false
false
false
true
true
false
2,532
2025E
In the most popular card game in Berland, a deck of $$$n imes m$$$ cards is used. Each card has two parameters: suit and rank. Suits in the game are numbered from $$$1$$$ to $$$n$$$, and ranks are numbered from $$$1$$$ to $$$m$$$. There is exactly one card in the deck for each combination of suit and rank. A card with...
2,200
true
true
false
true
false
false
false
false
false
false
119
297A
Problem - 297A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,700
false
false
false
false
false
true
false
false
false
false
8,644
7A
A famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have been playing this old game on uninteresting, monotonous boards. Kalevitch decided to put an end to this tradition and to introduce a new attitude to chessboards. As before, the...
1,100
false
false
false
false
false
true
true
false
false
false
9,960
1472E
Polycarp has invited $$$n$$$ friends to celebrate the New Year. During the celebration, he decided to take a group photo of all his friends. Each friend can stand or lie on the side. Each friend is characterized by two values $$$h_i$$$ (their height) and $$$w_i$$$ (their width). On the photo the $$$i$$$-th friend will ...
1,700
false
false
false
true
true
false
false
true
true
false
3,320
1217F
You are given an undirected graph with $$$n$$$ vertices numbered from $$$1$$$ to $$$n$$$. Initially there are no edges. You are asked to perform some queries on the graph. Let $$$last$$$ be the answer to the latest query of the second type, it is set to $$$0$$$ before the first such query. Then the queries are the foll...
2,600
false
false
false
false
true
false
false
false
false
true
4,585
610A
Pasha has a wooden stick of some positive integer length _n_. He wants to perform exactly three cuts to get four parts of the stick. Each part must have some positive integer length and the sum of these lengths will obviously be _n_. Pasha likes rectangles but hates squares, so he wonders, how many ways are there to sp...
1,000
true
false
false
false
false
false
false
false
false
false
7,406
507C
Amr bought a new video game "Guess Your Way Out!". The goal of the game is to find an exit from the maze that looks like a perfect binary tree of height _h_. The player is initially standing at the root of the tree and the exit from the tree is located at some leaf node. Let's index all the leaf nodes from the left to ...
1,700
true
false
true
false
false
false
false
false
false
false
7,814
1530F
Getting ready for VK Fest 2021, you prepared a table with $$$n$$$ rows and $$$n$$$ columns, and filled each cell of this table with some event related with the festival that could either happen or not: for example, whether you will win a prize on the festival, or whether it will rain. Forecasting algorithms used in VK ...
2,600
true
false
false
true
false
false
false
false
false
false
3,010
1326D2
This is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task. You are given a string $$$s$$$, consisting of lowercase English letters. Find the longest string, $$$t$$$, which satisf...
1,800
false
true
false
false
false
false
false
true
false
false
4,083
204E
The Little Elephant loves strings very much. He has an array _a_ from _n_ strings, consisting of lowercase English letters. Let's number the elements of the array from 1 to _n_, then let's denote the element number _i_ as _a__i_. For each string _a__i_ (1u2009≤u2009_i_u2009≤u2009_n_) the Little Elephant wants to find t...
2,800
false
false
true
false
true
false
false
false
false
false
9,023
1131B
You still have partial information about the score during the historic football match. You are given a set of pairs $$$(a_i, b_i)$$$, indicating that at some point during the match the score was "$$$a_i$$$: $$$b_i$$$". It is known that if the current score is «$$$x$$$:$$$y$$$», then after the goal it will change to "$$...
1,400
false
true
true
false
false
false
false
false
false
false
5,067
272E
Problem - 272E - 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,200
false
false
false
false
false
true
false
false
false
true
8,742
1329C
Drazil likes heap very much. So he created a problem with heap: There is a max heap with a height $$$h$$$ implemented on the array. The details of this heap are the following: This heap contains exactly $$$2^h - 1$$$ distinct positive non-zero integers. All integers are distinct. These numbers are stored in the array $...
2,400
false
true
true
false
true
true
false
false
false
false
4,063
1382B
There are $$$n$$$ piles of stones, where the $$$i$$$-th pile has $$$a_i$$$ stones. Two people play a game, where they take alternating turns removing stones. In a move, a player may remove a positive number of stones from the first non-empty pile (the pile with the minimal index, that has at least one stone). The first...
1,100
false
false
false
true
false
false
false
false
false
false
3,757
1326A
You are given a integer $$$n$$$ ($$$n > 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers: In the decimal representation of $$$s$$$: $$$s > 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of it's d...
1,000
false
false
false
false
false
true
false
false
false
false
4,087
413B
The R2 company has _n_ employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has _m_ Spyke chats just to discuss all sorts of issues. In each chat, some group of employees exchanges ...
1,300
false
false
true
false
false
false
false
false
false
false
8,173
435B
Problem - 435B - 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
false
true
false
false
false
false
false
false
false
false
8,101
1101B
An accordion is a string (yes, in the real world accordions are musical instruments, but let's forget about it for a while) which can be represented as a concatenation of: an opening bracket (ASCII code $$$091$$$), a colon (ASCII code $$$058$$$), some (possibly zero) vertical line characters (ASCII code $$$124$$$), ano...
1,300
false
true
true
false
false
false
false
false
false
false
5,199
1704E
Cirno has a DAG (Directed Acyclic Graph) with $$$n$$$ nodes and $$$m$$$ edges. The graph has exactly one node that has no out edges. The $$$i$$$-th node has an integer $$$a_i$$$ on it. Every second the following happens: Let $$$S$$$ be the set of nodes $$$x$$$ that have $$$a_x > 0$$$. For all $$$x in S$$$, $$$1$$$ is...
2,200
true
false
true
true
false
true
true
false
false
true
2,051
681A
Codeforces user' handle color depends on his ratingxa0— it is red if his rating is greater or equal to 2400; it is orange if his rating is less than 2400 but greater or equal to 2200, etc. Each time participant takes part in a rated contest, his rating is changed depending on his performance. Anton wants the color of h...
800
false
false
true
false
false
false
false
false
false
false
7,103
850D
Ivan is reading a book about tournaments. He knows that a tournament is an oriented graph with exactly one oriented edge between each pair of vertices. The score of a vertex is the number of edges going outside this vertex. Yesterday Ivan learned Landau's criterion: there is tournament with scores _d_1u2009≤u2009_d_2u2...
2,800
true
true
false
true
false
true
false
false
false
true
6,348
981C
Ramesses knows a lot about problems involving trees (undirected connected graphs without cycles)! He created a new useful tree decomposition, but he does not know how to construct it, so he asked you for help! The decomposition is the splitting the edges of the tree in some simple paths in such a way that each two path...
1,400
false
false
true
false
false
false
false
false
false
false
5,798
1392I
As Kevin is in BigMan's house, suddenly a trap sends him onto a grid with $$$n$$$ rows and $$$m$$$ columns. BigMan's trap is configured by two arrays: an array $$$a_1,a_2,ldots,a_n$$$ and an array $$$b_1,b_2,ldots,b_m$$$. In the $$$i$$$-th row there is a heater which heats the row by $$$a_i$$$ degrees, and in the $$$j$...
3,300
true
false
false
false
false
false
false
false
false
true
3,708
1765H
There are $$$n$$$ people (numbered from $$$1$$$ to $$$n$$$) signed up for a doctor's appointment. The doctor has to choose in which order he will appoint these people. The $$$i$$$-th patient should be appointed among the first $$$p_i$$$ people. There are also $$$m$$$ restrictions of the following format: the $$$i$$$-th...
2,200
false
true
true
false
false
false
false
true
false
true
1,710
793A
Oleg the bank client checks share prices every day. There are _n_ share prices he is interested in. Today he observed that each second exactly one of these prices decreases by _k_ rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. ...
900
true
false
true
false
false
false
false
false
false
false
6,607