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
1154C
Polycarp has a cat and his cat is a real gourmet! Dependent on a day of the week he eats certain type of food: on Mondays, Thursdays and Sundays he eats fish food; on Tuesdays and Saturdays he eats rabbit stew; on other days of week he eats chicken stake. Polycarp plans to go on a trip and already packed his backpac...
1,400
true
false
true
false
false
false
false
false
false
false
4,941
1862D
Tema decided to improve his ice cream making skills. He has already learned how to make ice cream in a cone using exactly two balls. Before his ice cream obsession, Tema was interested in mathematics. Therefore, he is curious about the minimum number of balls he needs to have in order to make exactly $$$n$$$ different ...
1,300
true
false
false
false
false
true
false
true
false
false
1,110
1829G
In a carnival game, there is a huge pyramid of cans with $$$2023$$$ rows, numbered in a regular pattern as shown. If can $$$9^2$$$ is hit initially, then all cans colored red in the picture above would fall. You throw a ball at the pyramid, and it hits a single can with number $$$n^2$$$. This causes all cans that are s...
1,600
true
false
true
true
true
false
false
false
false
false
1,308
600F
Problem - 600F - Codeforces =============== xa0 ]( "21794") , _a_ is the size of the first part, _b_ is the size of the second part, _m_ is the number of edges in the graph. Each of the next _m_ lines contains two integers _x_,u2009_y_ (1u2009≀u2009_x_u2009≀u2009_a_,u20091u2009≀u2009_y_u2009≀u2009_b_), whe...
2,800
false
false
false
false
false
false
false
false
false
true
7,441
1866F
After the success of the basketball teams formed and trained by Pak Chanek last year (Basketball Together), Pak Chanek wants to measure the performance of each player that is considered as a superstar. There are $$$N$$$ superstar players that have been trained by Pak Chanek. At the end of the season, some calculations ...
3,100
false
false
false
false
true
false
false
true
true
false
1,083
239A
Problem - 239A - 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,200
true
true
true
false
false
false
false
false
false
false
8,879
522B
One day _n_ friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together. Simply speaking, the process of taking photos can be described as follows. On the photo, each photographed friend occupies a rectangle of pixels: the _i_-th of them occupies the rectangle ...
1,100
false
false
true
true
true
false
false
false
false
false
7,749
1016C
Vasya's house is situated in a forest, and there is a mushroom glade near it. The glade consists of two rows, each of which can be divided into _n_ consecutive cells. For each cell Vasya knows how fast the mushrooms grow in this cell (more formally, how many grams of mushrooms grow in this cell each minute). Vasya spen...
1,800
false
false
true
true
false
false
false
false
false
false
5,610
1325D
Problem - 1325D - 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
true
false
false
false
true
false
false
false
false
4,090
1592E
Bakry got bored of solving problems related to xor, so he asked you to solve this problem for him. You are given an array $$$a$$$ of $$$n$$$ integers $$$ β€” the length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, ldots, a_n$$$ ($$$1 le a_i le 10^6$$$) β€” elements of the array. Output Print a singl...
2,400
true
true
false
false
false
false
false
false
false
false
2,689
1211G
There are $$$n$$$ cities and $$$n-1$$$ two-way roads in Treeland. Each road connects a pair of different cities. From any city you can drive to any other, moving only along the roads. Cities are numbered from $$$1$$$ to $$$n$$$. Yes, of course, you recognized an undirected tree in this description. There is exactly one...
2,500
true
false
false
false
false
false
false
false
false
false
4,622
1858E1
This is an easy version of this problem. The only difference between the versions is that you have to solve the hard version in online mode. You can make hacks only if both versions of the problem are solved. You have an array $$$a$$$, which is initially empty. You need to process queries of the following types: + $$$...
2,500
false
false
false
false
true
false
true
false
false
false
1,133
749B
Long time ago Alex created an interesting problem about parallelogram. The input data for this problem contained four integer points on the Cartesian plane, that defined the set of vertices of some non-degenerate (positive area) parallelogram. Points not necessary were given in the order of clockwise or counterclockwis...
1,200
false
false
false
false
false
true
true
false
false
false
6,797
443A
Problem - 443A - 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
true
false
false
false
false
8,065
1995B1
This is the easy version of the problem. The only difference is that in this version, the flowers are specified by enumeration. A girl is preparing for her birthday and wants to buy the most beautiful bouquet. There are a total of $$$n$$$ flowers in the store, each of which is characterized by the number of petals, and...
1,100
false
true
false
false
false
false
true
true
true
false
296
1861B
You are given two strings $$$a$$$ and $$$b$$$ of equal length, consisting of only characters 0 and/or 1; both strings start with character 0 and end with character 1. You can perform the following operation any number of times (possibly zero): choose one of the strings and two equal characters in it; then turn all cha...
1,000
false
true
false
true
false
true
false
false
false
false
1,118
1810H
You are given a multiset $$$S$$$. Initially, $$$S = {1,2,3, ldots, n}$$$. You will perform the following operation $$$n-1$$$ times. Choose the largest number $$$S_{ ext{max}}$$$ in $$$S$$$ and the smallest number $$$S_{ ext{min}}$$$ in $$$S$$$. Remove the two numbers from $$$S$$$, and add $$$S_{ ext{max}} - S_{ ext{mi...
2,900
true
false
false
false
false
false
false
false
false
false
1,406
641D
Little Artyom decided to study probability theory. He found a book with a lot of nice exercises and now wants you to help him with one of them. Consider two dices. When thrown each dice shows some integer from 1 to _n_ inclusive. For each dice the probability of each outcome is given (of course, their sum is 1), and di...
2,400
true
false
true
true
false
false
false
false
false
false
7,248
1873C
A $$$10 imes 10$$$ target is made out of five "rings" as shown. Each ring has a different point value: the outermost ringxa0β€” 1 point, the next ringxa0β€” 2 points, ..., the center ringxa0β€” 5 points. Vlad fired several arrows at the target. Help him determine how many points he got. Input The input consists of multiple ...
800
true
false
true
false
false
false
false
false
false
false
1,042
1619G
Polycarp is very fond of playing the game Minesweeper. Recently he found a similar game and there are such rules. There are mines on the field, for each the coordinates of its location are known ($$$x_i, y_i$$$). Each mine has a lifetime in seconds, after which it will explode. After the explosion, the mine also detona...
2,000
false
true
false
false
false
false
false
true
true
false
2,529
143A
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
1,000
true
false
false
false
false
false
true
false
false
false
9,302
1705C
One night, Mark realized that there is an essay due tomorrow. He hasn't written anything yet, so Mark decided to randomly copy-paste substrings from the prompt to make the essay. More formally, the prompt is a string $$$s$$$ of initial length $$$n$$$. Mark will perform the copy-pasting operation $$$c$$$ times. Each ope...
1,400
false
false
true
false
false
false
true
false
false
false
2,044
508E
Notice that the memory limit is non-standard. Recently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he even got himself a favorite correct bracket sequence of length 2_n_. Unlike Arthur, Sasha understood the topi...
2,200
false
true
false
true
false
false
false
false
false
false
7,807
1821E
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 characters of the sequence. For example: bracket sequences "()()" and "(())" are regular (the resulting expressions are: "(1)+(1)" and "((1+1)+1)"); br...
2,100
false
true
false
true
false
false
true
false
true
false
1,353
1934D1
This is the solo version of the problem. Note that the solution of this problem may or may not share ideas with the solution of the game version. You can solve and get points for both versions independently. You can make hacks only if both versions of the problem are solved. Given an integer variable $$$x$$$ with the i...
2,100
false
true
false
false
false
true
false
false
false
false
677
165B
One day a highly important task was commissioned to Vasya β€” writing a program in a night. The program consists of _n_ lines of code. Vasya is already exhausted, so he works like that: first he writes _v_ lines of code, drinks a cup of tea, then he writes as much as lines, drinks another cup of tea, then he writes lines...
1,500
false
false
true
false
false
false
false
true
false
false
9,204
1740C
There are $$$n$$$ bricks numbered from $$$1$$$ to $$$n$$$. Brick $$$i$$$ has a weight of $$$a_i$$$. Pak Chanek has $$$3$$$ bags numbered from $$$1$$$ to $$$3$$$ that are initially empty. For each brick, Pak Chanek must put it into one of the bags. After this, each bag must contain at least one brick. After Pak Chanek d...
1,400
false
true
false
false
false
true
false
false
true
false
1,845
1799D1
This is an easy 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$$$ se...
1,900
false
false
false
true
false
false
false
false
false
false
1,481
241E
LiLand is a country, consisting of _n_ cities. The cities are numbered from 1 to _n_. The country is well known because it has a very strange transportation system. There are many one-way flights that make it possible to travel between the cities, but the flights are arranged in a way that once you leave a city you wil...
2,600
false
false
false
false
false
false
false
false
false
true
8,871
822F
The second semester starts at the University of Pavlopolis. After vacation in Vičkopolis Noora needs to return to Pavlopolis and continue her study. Sometimes (or quite often) there are teachers who do not like you. Incidentally Noora also has one such teacher. His name is Yury Dmitrievich and he teaches graph theory. ...
2,500
false
false
false
false
false
true
false
false
false
false
6,463
1769D3
Π’ этой вСрсии Π·Π°Π΄Π°Ρ‡ΠΈ Π½ΡƒΠΆΠ½ΠΎ Π½Π°ΠΉΡ‚ΠΈ $$$26$$$ раскладов с Ρ€Π°Π·Π»ΠΈΡ‡Π½Ρ‹ΠΌΠΈ значСниями ваТности ΠΏΠ΅Ρ€Π²ΠΎΠ³ΠΎ Ρ…ΠΎΠ΄Π°. Алиса ΠΈ Π‘ΠΎΠ± Ρ€Π΅ΡˆΠΈΠ»ΠΈ ΡΡ‹Π³Ρ€Π°Ρ‚ΡŒ Π² ΠΊΠ°Ρ€Ρ‚ΠΎΡ‡Π½ΡƒΡŽ ΠΈΠ³Ρ€Ρƒ «ДСвятка». ΠŸΠΎΠΆΠ°Π»ΡƒΠΉΡΡ‚Π°, Π²Π½ΠΈΠΌΠ°Ρ‚Π΅Π»ΡŒΠ½ΠΎ ΠΏΡ€ΠΎΡ‡ΠΈΡ‚Π°ΠΉΡ‚Π΅ условиС Π·Π°Π΄Π°Ρ‡ΠΈ, ΠΏΠΎΡΠΊΠΎΠ»ΡŒΠΊΡƒ ΠΏΡ€Π°Π²ΠΈΠ»Π° ΠΌΠΎΠ³ΡƒΡ‚ ΠΎΡ‚Π»ΠΈΡ‡Π°Ρ‚ΡŒΡΡ ΠΎΡ‚ извСстных Π²Π°ΠΌ. Для ΠΈΠ³Ρ€Ρ‹ Π½ΡƒΠΆΠ½Π° стандартная ΠΊΠΎΠ»ΠΎΠ΄Π° ΠΈΠ· $$$36$$$ ΠΊΠ°Ρ€Ρ‚xa0β€” ΠΏΠΎ дСвя...
2,300
false
false
false
false
false
false
true
false
false
false
1,678
1759F
A positive number $$$x$$$ of length $$$n$$$ in base $$$p$$$ ($$$2 le p le 10^9$$$) is written on the blackboard. The number $$$x$$$ is given as a sequence $$$a_1, a_2, dots, a_n$$$ ($$$0 le a_i < p$$$) β€” the digits of $$$x$$$ in order from left to right (most significant to least significant). Dmitry is very fond of al...
1,800
true
true
false
false
true
false
false
true
false
false
1,757
1374E2
, # Reading Books (hard version) Input file: standard input Output file: standard output Time limit: 3 seconds Memory limit: 256 megabytes Easy and hard versions are actually different problems, so read statements of both problems completely and carefully .Summer vacation has started so Alice and Bob want to play a...
2,500
false
true
true
false
true
false
false
false
true
false
3,789
1624A
Polycarp got an array of integers $$$a[1 dots n]$$$ as a gift. Now he wants to perform a certain number of operations (possibly zero) so that all elements of the array become the same (that is, to become $$$a_1=a_2=dots=a_n$$$). In one operation, he can take some indices in the array and increase the elements of the a...
800
true
false
false
false
false
false
false
false
false
false
2,500
1656I
Given an undirected graph $$$G$$$, we say that a neighbour ordering is an ordered list of all the neighbours of a vertex for each of the vertices of $$$G$$$. Consider a given neighbour ordering of $$$G$$$ and three vertices $$$u$$$, $$$v$$$ and $$$w$$$, such that $$$v$$$ is a neighbor of $$$u$$$ and $$$w$$$. We write $...
3,500
false
false
false
false
false
true
false
false
false
true
2,346
780C
Andryusha goes through a park each day. The squares and paths between them look boring to Andryusha, so he decided to decorate them. The park consists of _n_ squares connected with (_n_u2009-u20091) bidirectional paths in such a way that any square is reachable from any other using these paths. Andryusha decided to han...
1,600
false
true
false
false
false
false
false
false
false
true
6,646
8C
Girl Lena likes it when everything is in order, and looks for order everywhere. Once she was getting ready for the University and noticed that the room was in a mess β€” all the objects from her handbag were thrown about the room. Of course, she wanted to put them back into her handbag. The problem is that the girl canno...
2,000
false
false
false
true
false
false
false
false
false
false
9,953
798D
Mike has always been thinking about the harshness of social inequality. He's so obsessed with it that sometimes it even affects him while solving problems. At the moment, Mike has two sequences of positive integers _A_u2009=u2009[_a_1,u2009_a_2,u2009...,u2009_a__n_] and _B_u2009=u2009[_b_1,u2009_b_2,u2009...,u2009_b__n...
2,400
false
false
false
false
false
true
false
false
true
false
6,578
1461F
Barbara was late for her math class so as a punishment the teacher made her solve the task on a sheet of paper. Barbara looked at the sheet of paper and only saw $$$n$$$ numbers $$$a_1, a_2, ldots, a_n$$$ without any mathematical symbols. The teacher explained to Barbara that she has to place the available symbols betw...
2,700
false
true
false
true
false
true
false
false
false
false
3,381
1456E
Given integers $$$c_{0}, c_{1}, ldots, c_{k-1}$$$ we can define the cost of a number $$$0 le x < 2^{k}$$$ as $$$p(x) = sum_{i=0}^{k-1} left( leftlfloor frac{x}{2^{i}} ight floor bmod 2 ight) cdot c_{i}$$$. In other words, the cost of number $$$x$$$ is the sum of $$$c_{i}$$$ over the bits of $$$x$$$ which are equal to...
3,500
false
true
false
true
false
false
false
false
false
false
3,395
1814A
Problem - 1814A - 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
1,387
786C
Rick and Morty want to find MR. PBH and they can't do it alone. So they need of Mr. Meeseeks. They Have generated _n_ Mr. Meeseeks, standing in a line numbered from 1 to _n_. Each of them has his own color. _i_-th Mr. Meeseeks' color is _a__i_. Rick and Morty are gathering their army and they want to divide Mr. Meeseek...
2,400
false
false
false
false
true
false
false
false
false
false
6,626
546C
Two bored soldiers are playing card war. Their card deck consists of exactly _n_ cards, numbered from 1 to _n_, all values are different. They divide cards between them in some manner, it's possible that they have different number of cards. Then they play a "war"-like card game. The rules are following. On each turn a ...
1,400
false
false
false
false
false
false
true
false
false
false
7,655
1945C
In the village of Letovo, there are $$$n$$$ houses. The villagers decided to build a big road that will divide the village into left and right sides. Each resident wants to live on either the right or the left side of the street, which is described as a sequence $$$a_1, a_2, dots, a_n$$$, where $$$a_j = 0$$$ if the res...
1,200
false
false
false
false
false
false
true
false
false
false
611
1622D
You are given a binary string (i.u2009e. a string consisting of characters 0 and/or 1) $$$s$$$ of length $$$n$$$. You can perform the following operation with the string $$$s$$$ at most once: choose a substring (a contiguous subsequence) of $$$s$$$ having exactly $$$k$$$ characters 1 in it, and shuffle it (reorder the ...
2,000
true
false
false
false
false
false
false
false
false
false
2,508
641B
Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it. That element can store information about the matrix of integers size _n_u2009Γ—u2009_...
1,400
false
false
true
false
false
false
false
false
false
false
7,250
856D
Masha is fond of cacti. When she was a little girl, she decided to plant a tree. Now Masha wants to make a nice cactus out of her tree. Recall that tree is a connected undirected graph that has no cycles. Cactus is a connected undirected graph such that each vertex belongs to at most one cycle. Masha has some additiona...
2,400
false
false
false
true
false
false
false
false
false
false
6,317
327C
Problem - 327C - 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
true
false
false
false
false
false
false
false
false
false
8,534
412C
Developers often face with regular expression patterns. A pattern is usually defined as a string consisting of characters and metacharacters that sets the rules for your search. These patterns are most often used to check whether a particular string meets the certain rules. In this task, a pattern will be a string cons...
1,200
false
false
true
false
false
false
false
false
false
false
8,177
1820A
After holding one team contest, boy Yura got very tired and wanted to change his life and move to Japan. In honor of such a change, Yura changed his name to something nice. Fascinated by this idea he already thought up a name $$$s$$$ consisting only of characters "_" and "^". But there's a problem β€” Yura likes smiley f...
800
false
false
true
false
false
false
false
false
false
false
1,359
242E
You've got an array _a_, consisting of _n_ integers _a_1,u2009_a_2,u2009...,u2009_a__n_. You are allowed to perform two operations on this array: 1. Calculate the sum of current array elements on the segment [_l_,u2009_r_], that is, count value _a__l_u2009+u2009_a__l_u2009+u20091u2009+u2009...u2009+u2009_a__r_. 2. Appl...
2,000
false
false
false
false
true
false
false
false
false
false
8,864
1070D
Enough is enough. Too many times it happened that Vasya forgot to dispose of garbage and his apartment stank afterwards. Now he wants to create a garbage disposal plan and stick to it. For each of next $$$n$$$ days Vasya knows $$$a_i$$$ β€” number of units of garbage he will produce on the $$$i$$$-th day. Each unit of ga...
1,300
false
true
false
false
false
false
false
false
false
false
5,364
215C
There is a board with a grid consisting of _n_ rows and _m_ columns, the rows are numbered from 1 from top to bottom and the columns are numbered from 1 from left to right. In this grid we will denote the cell that lies on row number _i_ and column number _j_ as (_i_,u2009_j_). A group of six numbers (_a_,u2009_b_,u200...
2,100
false
false
true
false
false
false
true
false
false
false
8,979
837F
Problem - 837F - Codeforces =============== xa0 , where _x_ is an array of _m_ integers, which returns an array _y_ consisting of _m_u2009+u20091 integers such that _y__i_ is equal to the sum of first _i_ elements of array _x_ (0u2009≀u2009_i_u2009≀u2009_m_). You have an infinite sequence of arrays _A_0,u...
2,400
true
false
false
false
false
false
true
true
false
false
6,416
877F
In Ann's favorite book shop are as many as _n_ books on math and economics. Books are numbered from 1 to _n_. Each of them contains non-negative number of problems. Today there is a sale: any subsegment of a segment from _l_ to _r_ can be bought at a fixed price. Ann decided that she wants to buy such non-empty subsegm...
2,300
false
false
false
false
true
false
false
false
false
false
6,235
1697B
The store sells $$$n$$$ items, the price of the $$$i$$$-th item is $$$p_i$$$. The store's management is going to hold a promotion: if a customer purchases at least $$$x$$$ items, $$$y$$$ cheapest of them are free. The management has not yet decided on the exact values of $$$x$$$ and $$$y$$$. Therefore, they ask you to ...
900
false
true
false
false
false
false
false
false
true
false
2,099
1566H
This is an interactive problem. You are given two integers $$$c$$$ and $$$n$$$. The jury has a randomly generated set $$$A$$$ of distinct positive integers not greater than $$$c$$$ (it is generated from all such possible sets with equal probability). The size of $$$A$$$ is equal to $$$n$$$. Your task is to guess the se...
3,200
true
false
false
true
false
true
false
false
false
false
2,805
1996G
On Penacony, The Land of the Dreams, there exists $$$n$$$ houses and $$$n$$$ roads. There exists a road between house $$$i$$$ and $$$i+1$$$ for all $$$1 leq i leq n-1$$$ and a road between house $$$n$$$ and house $$$1$$$. All roads are bidirectional. However, due to the crisis on Penacony, the overseeing family has gon...
2,200
false
true
false
false
true
false
true
false
false
true
284
1933A
You are given an array $$$a$$$ of $$$n$$$ integers. You must perform the following two operations on the array (the first, then the second): 1. Arbitrarily rearrange the elements of the array or leave the order of its elements unchanged. 2. Choose at most one contiguous segment of elements and replace the signs of all ...
800
true
true
false
false
false
false
false
false
true
false
687
25B
Problem - 25B - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so...
1,100
false
false
true
false
false
false
false
false
false
false
9,872
1478C
Long time ago there was a symmetric array $$$a_1,a_2,ldots,a_{2n}$$$ consisting of $$$2n$$$ distinct integers. Array $$$a_1,a_2,ldots,a_{2n}$$$ is called symmetric if for each integer $$$1 le i le 2n$$$, there exists an integer $$$1 le j le 2n$$$ such that $$$a_i = -a_j$$$. For each integer $$$1 le i le 2n$$$, Nezzar w...
1,700
true
false
true
false
false
false
false
false
true
false
3,282
1398B
Alice and Bob play a game. They have a binary string $$$s$$$ (a string such that each character in it is either $$$0$$$ or $$$1$$$). Alice moves first, then Bob, then Alice again, and so on. During their move, the player can choose any number (not less than one) of consecutive equal characters in $$$s$$$ and delete the...
800
false
true
false
false
false
false
false
false
true
false
3,685
710F
You should process _m_ queries over a set _D_ of strings. Each query is one of three kinds: 1. Add a string _s_ to the set _D_. It is guaranteed that the string _s_ was not added before. 2. Delete a string _s_ from the set _D_. It is guaranteed that the string _s_ is in the set _D_. 3. For the given string _s_ find the...
2,400
false
false
false
false
true
false
true
false
false
false
6,977
148A
Problem - 148A - 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
true
false
true
false
false
true
false
false
false
false
9,286
536E
Tavas lives in Tavaspolis. Tavaspolis has _n_ cities numbered from 1 to _n_ connected by _n_u2009-u20091 bidirectional roads. There exists a path between any two cities. Also each road has a length. Tavas' favorite strings are binary strings (they contain only 0 and 1). For any binary string like _s_u2009=u2009_s_1_s_2...
3,100
false
false
false
false
true
false
false
false
false
false
7,689
1195C
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. $$$2 cdot n$$$ students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly $$$n$$$ people in each row). Students are numbered from $$$1$$$ to $$$n$$$...
1,400
false
false
false
true
false
false
false
false
false
false
4,727
1277D
Polycarp has $$$n$$$ different binary words. A word called binary if it contains only characters '0' and '1'. For example, these words are binary: "0001", "11", "0" and "0011100". Polycarp wants to offer his set of $$$n$$$ binary words to play a game "words". In this game, players name words and each next word (startin...
1,900
true
false
true
false
true
false
false
false
false
false
4,307
53C
Problem - 53C - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so...
1,200
false
false
false
false
false
true
false
false
false
false
9,708
920D
Petya sometimes has to water his field. To water the field, Petya needs a tank with exactly _V_ ml of water. Petya has got _N_ tanks, _i_-th of them initially containing _a__i_ ml of water. The tanks are really large, any of them can contain any amount of water (no matter how large this amount is). Also Petya has got a...
2,400
false
true
true
true
false
false
false
false
false
false
6,047
915D
You are given a . You are allowed to remove at most one edge from it. Can you make this graph . Input The first line contains two integers _n_ and _m_ (2u2009≀u2009_n_u2009≀u2009500, 1u2009≀u2009_m_u2009≀u2009_min_(_n_(_n_u2009-u20091),u2009100000)) β€” the number of vertices and the number of edges, respectively. Then _...
2,200
false
false
false
false
false
false
false
false
false
true
6,072
1687E
Come, let's build a world where even the weak are not forgotten! β€”Kijin Seija, Double Dealing Characters Shinmyoumaru has a mallet that can turn objects bigger or smaller. She is testing it out on a sequence $$$a$$$ and a number $$$v$$$ whose initial value is $$$1$$$. She wants to make $$$v = gcdlimits_{i e j}{a_icdot ...
3,500
true
true
false
false
false
true
false
false
false
false
2,153
1202C
You have a string $$$s$$$ β€” a sequence of commands for your toy robot. The robot is placed in some cell of a rectangular grid. He can perform four commands: 'W' β€” move one cell up; 'S' β€” move one cell down; 'A' β€” move one cell left; 'D' β€” move one cell right. Let $$$Grid(s)$$$ be the grid of minimum possible area s...
2,100
true
true
true
true
true
false
true
false
false
false
4,687
254D
Rats have bred to hundreds and hundreds in the basement of the store, owned by Vasily Petrovich. Vasily Petrovich may have not noticed their presence, but they got into the habit of sneaking into the warehouse and stealing food from there. Vasily Petrovich cannot put up with it anymore, he has to destroy the rats in th...
2,300
false
false
true
false
false
false
true
false
false
true
8,816
1675C
Polycarp bought a new expensive painting and decided to show it to his $$$n$$$ friends. He hung it in his room. $$$n$$$ of his friends entered and exited there one by one. At one moment there was no more than one person in the room. In other words, the first friend entered and left first, then the second, and so on. It...
1,100
false
false
true
false
false
false
false
false
false
false
2,220
2038I
Berland is this year's host country of the International Collegiate Polyathlon Competition! Similar to biathlon being a competition of two sports, polyathlon is a competition of many sports. This year, there are $$$m$$$ sports. Also, there are $$$n$$$ participants in the event. The sports are numbered from $$$1$$$ to $...
2,500
false
false
false
false
true
false
false
true
false
false
30
1689B
Monocarp is a little boy who lives in Byteland and he loves programming. Recently, he found a permutation of length $$$n$$$. He has to come up with a mystic permutation. It has to be a new permutation such that it differs from the old one in each position. More formally, if the old permutation is $$$p_1,p_2,ldots,p_n$$...
900
false
true
false
false
true
false
false
false
false
false
2,147
1296E2
This is a hard version of the problem. The actual problems are different, but the easy version is almost a subtask of the hard version. Note that the constraints and the output format are different. You are given a string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters. You have to color all its characters the mi...
2,000
false
false
false
true
true
false
false
false
false
false
4,212
1508C
As a teacher, Riko Hakozaki often needs to help her students with problems from various subjects. Today, she is asked a programming task which goes as follows. You are given an undirected complete graph with $$$n$$$ nodes, where some edges are pre-assigned with a positive weight while the rest aren't. You need to assig...
2,500
false
true
false
false
true
false
true
false
false
true
3,134
1452C
You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', ' (", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two. In the third example you can first erase the brackets on positions $$$1$$$ and $$$3$$$...
800
false
true
false
false
false
false
false
false
false
false
3,419
1076E
Vasya has a tree consisting of $$$n$$$ vertices with root in vertex $$$1$$$. At first all vertices has $$$0$$$ written on it. Let $$$d(i, j)$$$ be the distance between vertices $$$i$$$ and $$$j$$$, i.e. number of edges in the shortest path from $$$i$$$ to $$$j$$$. Also, let's denote $$$k$$$-subtree of vertex $$$x$$$ β€” ...
1,900
false
false
false
false
true
false
false
false
false
false
5,340
1327D
You are given a colored permutation $$$p_1, p_2, dots, p_n$$$. The $$$i$$$-th element of the permutation has color $$$c_i$$$. Let's define an infinite path as infinite sequence $$$i, p[i], p[p[i]], p[p[p[i]]] dots$$$ where all elements have same color ($$$c[i] = c[p[i]] = c[p[p[i]]] = dots$$$). We can also define a mul...
2,200
true
false
false
false
false
false
true
false
false
true
4,075
2022E1
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 978 (Div. 2) Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If...
2,500
false
false
false
false
false
true
false
true
false
true
133
446A
Problem - 446A - 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
true
true
false
false
false
false
false
false
8,056
785C
Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to build a huge barn to put there all his grain. Best builders were building that bar...
1,600
true
false
false
false
false
false
false
true
false
false
6,631
1638A
You are given a permutation $$$p_1, p_2, ldots, p_n$$$ of length $$$n$$$. You have to choose two integers $$$l,r$$$ ($$$1 le l le r le n$$$) and reverse the subsegment $$$[l,r]$$$ of the permutation. The permutation will become $$$p_1,p_2, dots, p_{l-1},p_r,p_{r-1}, dots, p_l,p_{r+1},p_{r+2}, dots ,p_n$$$. Find the lex...
800
true
true
false
false
false
true
false
false
false
false
2,426
1152B
Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat. Assume that we have a cat with a number $$$x$$$. A perfect longcat is a cat with a number equal $$$2^m - 1$$$ for ...
1,300
true
false
false
false
false
true
false
false
false
false
4,955
2039G
Shohag has a tree with $$$n$$$ nodes. Pebae has an integer $$$m$$$. She wants to assign each node a valuexa0β€” an integer from $$$1$$$ to $$$m$$$. So she asks Shohag to count the number, modulo $$$998,244,353$$$, of assignments such that following conditions are satisfied: For each pair $$$1 le u lt v le n$$$, the ]( o...
3,500
true
false
false
false
false
false
false
false
false
false
16
171F
Problem - 171F - Codeforces =============== xa0 β€” jxu edu-rqiut ydtun ev jxu ucyhf je vydt. Output ekjfkj q iydwbu dkcruh. Examples Input 1 Output 13
1,600
false
false
true
false
false
false
true
false
false
false
9,181
1179A
Recently, on the course of algorithms and data structures, Valeriy learned how to use a deque. He built a deque filled with $$$n$$$ elements. The $$$i$$$-th element is $$$a_i$$$ ($$$i$$$ = $$$1, 2, ldots, n$$$). He gradually takes the first two leftmost elements from the deque (let's call them $$$A$$$ and $$$B$$$, resp...
1,500
false
false
true
false
true
false
false
false
false
false
4,821
822B
Erelong Leha was bored by calculating of the greatest common divisor of two factorials. Therefore he decided to solve some crosswords. It's well known that it is a very interesting occupation though it can be very difficult from time to time. In the course of solving one of the crosswords, Leha had to solve a simple ta...
1,000
false
false
true
false
false
false
true
false
false
false
6,467
1776I
The two siblings Alberto and Beatrice have to eat a spinach pizza together. However, none of them likes spinach, so they both want to eat as little as possible. The pizza has the shape of a strictly convex polygon with $$$n$$$ vertices located at integer coordinates $$$(x_1, y_1), , (x_2, y_2), , dots, , (x_n, y_n)$$$ ...
2,500
false
true
false
false
false
false
false
false
false
false
1,620
1621H
Railway network of one city consists of $$$n$$$ stations connected by $$$n-1$$$ roads. These stations and roads forms a tree. Station $$$1$$$ is a city center. For each road you know the time trains spend to pass this road. You can assume that trains don't spend time on stops. Let's define $$$dist(v)$$$ as the time tha...
3,500
false
false
false
false
false
false
false
false
false
true
2,513
1141F1
This problem is given in two editions, which differ exclusively in the constraints on the number $$$n$$$. You are given an array of integers $$$a[1], a[2], dots, a[n].$$$ A block is a sequence of contiguous (consecutive) elements $$$a[l], a[l+1], dots, a[r]$$$ ($$$1 le l le r le n$$$). Thus, a block is defined by a pai...
1,900
false
true
false
false
false
false
false
false
false
false
5,016
1486A
You have $$$n$$$ stacks of blocks. The $$$i$$$-th stack contains $$$h_i$$$ blocks and it's height is the number of blocks in it. In one move you can take a block from the $$$i$$$-th stack (if there is at least one block) and put it to the $$$i + 1$$$-th stack. Can you make the sequence of heights strictly increasing? N...
900
false
true
true
false
false
false
false
false
false
false
3,253
1280F
You are an intergalactic surgeon and you have an alien patient. For the purposes of this problem, we can and we will model this patient's body using a $$$2 imes (2k + 1)$$$ rectangular grid. The alien has $$$4k + 1$$$ distinct organs, numbered $$$1$$$ to $$$4k + 1$$$. In healthy such aliens, the organs are arranged in...
3,400
true
false
false
false
false
true
false
false
false
false
4,289
557D
After Vitaly was expelled from the university, he became interested in the graph theory. Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once. Vitaly was wondering how to solve the following problem. You are given an undirected graph consisting of _n_ vertices and _m_ edges, not ...
2,000
true
false
false
false
false
false
false
false
false
true
7,605
1625E2
This is the hard version of the problem. The only difference between the easy and the hard versions are removal queries, they are present only in the hard version. "Interplanetary Software, Inc." together with "Robots of Cydonia, Ltd." has developed and released robot cats. These electronic pets can meow, catch mice an...
2,800
false
false
false
false
true
false
false
true
false
true
2,488
1983A
An array of integers $$$a_1,a_2,cdots,a_n$$$ is beautiful subject to an integer $$$k$$$ if it satisfies the following: The sum of $$$a_{j}$$$ over all $$$j$$$ such that $$$j$$$ is a multiple of $$$k$$$ and $$$1 le j le n $$$, itself, is a multiple of $$$k$$$. More formally, if $$$sum_{k j} a_{j}$$$ is divisible by $...
800
true
false
false
false
false
true
false
false
false
false
390
286E
A ladies' shop has recently opened in the city of Ultima Thule. To get ready for the opening, the shop bought _n_ bags. Each bag is characterised by the total weight _a__i_ of the items you can put there. The weird thing is, you cannot use these bags to put a set of items with the total weight strictly less than _a__i_...
2,800
true
false
false
false
false
true
false
false
false
false
8,687
699B
You are given a description of a depot. It is a rectangular checkered field of _n_u2009Γ—u2009_m_ size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (_x_,u2009_y_), then after triggering it will wipe out all walls in the row _x_ and all...
1,400
false
false
true
false
false
false
false
false
false
false
7,026