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
526G
Spiders are Om Nom's old enemies. They love eating candies as much as he does and that's why they keep trying to keep the monster away from his favorite candies. They came up with an evil plan to trap Om Nom. Let's consider a rope structure consisting of _n_ nodes and _n_u2009-u20091 ropes connecting the nodes. The str...
3,300
false
true
false
false
false
false
false
false
false
false
7,725
598A
Problem - 598A - Codeforces =============== xa0 ]( "Announcement") — the number of values of _n_ to be processed. Each of next _t_ lines contains a single integer _n_ (1u2009≤u2009_n_u2009≤u2009109). Output Print the requested sum for each of _t_ integers _n_ given in the input. Examples Input 2 4 10...
900
true
false
false
false
false
false
false
false
false
false
7,457
1899D
Yarik is a big fan of many kinds of music. But Yarik loves not only listening to music but also writing it. He likes electronic music most of all, so he has created his own system of music notes, which, in his opinion, is best for it. Since Yarik also likes informatics, in his system notes are denoted by integers of $$...
1,300
true
false
false
false
false
false
false
false
false
false
919
643B
Bearland has _n_ cities, numbered 1 through _n_. Cities are connected via bidirectional roads. Each road connects two distinct cities. No two roads connect the same pair of cities. Bear Limak was once in a city _a_ and he wanted to go to a city _b_. There was no direct connection so he decided to take a long walk, visi...
1,600
false
false
false
false
false
true
false
false
false
true
7,243
24C
Problem - 24C - Codeforces =============== xa0 . Here point _B_ is symmetric to _A_ according _M_, if _M_ is the center of the line segment _AB_. Given index _j_ find the point _M__j_. Input On the first line you will be given an integer _n_ (1u2009≤u2009_n_u2009≤u2009105), which will be odd, and _j_ (1u2...
1,800
true
false
true
false
false
false
false
false
false
false
9,876
16A
Problem - 16A - 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...
800
false
false
true
false
false
false
false
false
false
false
9,915
1519A
You have $$$r$$$ red and $$$b$$$ blue beans. You'd like to distribute them among several (maybe, one) packets in such a way that each packet: has at least one red bean (or the number of red beans $$$r_i ge 1$$$); has at least one blue bean (or the number of blue beans $$$b_i ge 1$$$); the number of red and blue bean...
800
true
false
false
false
false
false
false
false
false
false
3,069
305C
Problem - 305C - 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
true
true
false
false
false
false
false
false
false
8,614
1334F
Let's denote the following function $$$f$$$. This function takes an array $$$a$$$ of length $$$n$$$ and returns an array. Initially the result is an empty array. For each integer $$$i$$$ from $$$1$$$ to $$$n$$$ we add element $$$a_i$$$ to the end of the resulting array if it is greater than all previous elements (more ...
2,500
false
true
false
true
true
false
false
true
false
false
4,032
1725M
Pak Chanek is playing one of his favourite board games. In the game, there is a directed graph with $$$N$$$ vertices and $$$M$$$ edges. In the graph, edge $$$i$$$ connects two different vertices $$$U_i$$$ and $$$V_i$$$ with a length of $$$W_i$$$. By using the $$$i$$$-th edge, something can move from $$$U_i$$$ to $$$V_i...
1,800
false
false
false
true
false
false
false
false
false
true
1,934
510C
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex...
1,600
false
false
false
false
false
false
false
false
true
true
7,798
340C
Problem - 340C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,600
true
false
true
false
false
false
false
false
false
false
8,473
1829B
Problem - 1829B - 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
1,313
95A
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name _w_ and the collection of forbidden substrings _s_1,u2009_s_2,u2009...,u2009_s__n_. All those strings consist of uppercas...
1,600
false
false
true
false
false
false
false
false
false
false
9,508
1301F
Jaber is a superhero in a large country that can be described as a grid with $$$n$$$ rows and $$$m$$$ columns, where every cell in that grid contains a different city. Jaber gave every city in that country a specific color between $$$1$$$ and $$$k$$$. In one second he can go from the current city to any of the cities a...
2,600
false
false
true
false
false
false
false
false
false
true
4,189
1971C
There is a clock labeled with the numbers $$$1$$$ through $$$12$$$ in clockwise order, as shown below. In this example, $$$(a,b,c,d)=(2,9,10,6)$$$, and the strings intersect. Alice and Bob have four distinct integers $$$a$$$, $$$b$$$, $$$c$$$, $$$d$$$ not more than $$$12$$$. Alice ties a red string connecting $$$a$$$ a...
900
false
false
true
false
false
false
false
false
false
false
463
1900A
Filip has a row of cells, some of which are blocked, and some are empty. He wants all empty cells to have water in them. He has two actions at his disposal: $$$1$$$xa0— place water in an empty cell. $$$2$$$xa0— remove water from a cell and place it in any other empty cell. If at some moment cell $$$i$$$ ($$$2 le i le...
800
false
true
true
false
false
true
false
false
false
false
915
1121C
Vasya likes taking part in Codeforces contests. When a round is over, Vasya follows all submissions in the system testing tab. There are $$$n$$$ solutions, the $$$i$$$-th of them should be tested on $$$a_i$$$ tests, testing one solution on one test takes $$$1$$$ second. The solutions are judged in the order from $$$1$$...
1,600
false
false
true
false
false
false
false
false
false
false
5,078
1611C
Polycarp wrote on a whiteboard an array $$$p$$$ of length $$$n$$$, which is a permutation of numbers from $$$1$$$ to $$$n$$$. In other words, in $$$p$$$ each number from $$$1$$$ to $$$n$$$ occurs exactly once. He also prepared a resulting array $$$a$$$, which is initially empty (that is, it has a length of $$$0$$$). Af...
1,000
false
false
false
false
false
true
false
false
false
false
2,589
1475A
Problem - 1475A - 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
false
false
false
false
false
false
false
false
false
3,304
447B
Problem - 447B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,000
false
true
true
false
false
false
false
false
false
false
8,050
1148D
You are given $$$n$$$ pairs of integers $$$(a_1, b_1), (a_2, b_2), ldots, (a_n, b_n)$$$. All of the integers in the pairs are distinct and are in the range from $$$1$$$ to $$$2 cdot n$$$ inclusive. Let's call a sequence of integers $$$x_1, x_2, ldots, x_{2k}$$$ good if either $$$x_1 < x_2 > x_3 < ldots < x_{2k-2} > x_...
1,800
false
true
false
false
false
false
false
false
true
false
4,974
1816B
Consider a $$$2 imes n$$$ grid, where $$$n$$$ is an even integer. You may place the integers $$$1, 2, ldots, 2n$$$ on the grid, using each integer exactly once. A path is a sequence of cells achieved by starting at $$$(1, 1)$$$, then repeatedly walking either downwards or to the right, and stopping when $$$(2, n)$$$ i...
1,000
false
true
false
false
false
true
false
false
false
false
1,374
596D
Wilbur the pig really wants to be a beaver, so he decided today to pretend he is a beaver and bite at trees to cut them down. There are _n_ trees located at various positions on a line. Tree _i_ is located at position _x__i_. All the given positions of the trees are distinct. The trees are equal, i.e. each tree has hei...
2,300
true
false
false
true
false
false
false
false
true
false
7,462
1401E
There is a square of size $$$10^6 imes 10^6$$$ on the coordinate plane with four points $$$(0, 0)$$$, $$$(0, 10^6)$$$, $$$(10^6, 0)$$$, and $$$(10^6, 10^6)$$$ as its vertices. You are going to draw segments on the plane. All segments are either horizontal or vertical and intersect with at least one side of the square....
2,400
false
false
true
false
true
false
false
false
true
false
3,661
90A
A group of university students wants to get to the top of a mountain to have a picnic there. For that they decided to use a cableway. A cableway is represented by some cablecars, hanged onto some cable stations by a cable. A cable is scrolled cyclically between the first and the last cable stations (the first of them i...
1,000
true
true
false
false
false
false
false
false
false
false
9,524
825A
Problem - 825A - Codeforces =============== xa0 . Digits are written one by one in order corresponding to number and separated by single '0' character. Though Polycarp learnt how to encode the numbers, he has no idea how to decode them back. Help him calculate the decoded number. Input The first line con...
1,100
false
false
true
false
false
false
false
false
false
false
6,462
797A
Problem - 797A - Codeforces =============== xa0 such that all these integers are strictly greater than 1, and their product is equal to _n_. Input The first line contains two integers _n_ and _k_ (2u2009≤u2009_n_u2009≤u2009100000, 1u2009≤u2009_k_u2009≤u200920). Output If it's impossible to find the repres...
1,100
true
false
true
false
false
false
false
false
false
false
6,587
1910E
Problem - 1910E - Codeforces =============== xa0 ]( --- Finished → Languages The following languages are only available languages for the problems from the contest Kotlin Heroes: Episode 9 (Unrated, T-Shirts + Prizes!): Kotlin 1.7.20 Kotlin 1.9.21 → Virtual participation Virtual contest is a way to take par...
2,100
false
false
false
true
false
false
false
false
false
false
843
45J
Problem - 45J - 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,800
false
false
false
false
false
true
false
false
false
false
9,750
1669F
There are $$$n$$$ candies put from left to right on a table. The candies are numbered from left to right. The $$$i$$$-th candy has weight $$$w_i$$$. Alice and Bob eat candies. Alice can eat any number of candies from the left (she can't skip candies, she eats them in a row). Bob can eat any number of candies from the r...
1,100
false
true
false
false
true
false
false
true
false
false
2,260
884C
The construction of subway in Bertown is almost finished! The President of Berland will visit this city soon to look at the new subway himself. There are _n_ stations in the subway. It was built according to the Bertown Transport Law: 1. For each station _i_ there exists exactly one train that goes from this station. I...
1,500
true
true
false
false
false
false
false
false
false
false
6,212
103B
...Once upon a time a man came to the sea. The sea was stormy and dark. The man started to call for the little mermaid to appear but alas, he only woke up Cthulhu... Whereas on the other end of the world Pentagon is actively collecting information trying to predict the monster's behavior and preparing the secret super ...
1,500
false
false
false
false
false
false
false
false
false
true
9,471
1168D
Toad Ilya has a rooted binary tree with vertex $$$1$$$ being the root. A tree is a connected graph without cycles. A tree is rooted if one vertex is selected and called the root. A vertex $$$u$$$ is a child of a vertex $$$v$$$ if $$$u$$$ and $$$v$$$ are connected by an edge and $$$v$$$ is closer to the root than $$$u$$...
3,000
false
false
true
true
false
false
false
false
false
false
4,873
871E
Problem - 871E - 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,900
false
true
false
false
false
false
false
false
false
true
6,255
525E
Anya loves to fold and stick. Today she decided to do just that. Anya has _n_ cubes lying in a line and numbered from 1 to _n_ from left to right, with natural numbers written on them. She also has _k_ stickers with exclamation marks. We know that the number of stickers does not exceed the number of cubes. Anya can sti...
2,100
true
false
false
true
false
false
true
true
false
false
7,732
1461A
One fall day Joe got bored because he couldn't find himself something interesting to do. Marty suggested Joe to generate a string of length $$$n$$$ to entertain him somehow. It didn't seem particularly difficult, but Joe's generated string had to follow these rules: the string may only contain characters 'a', 'b', or ...
800
false
true
false
false
false
true
false
false
false
false
3,386
919F
Imagine that Alice is playing a card game with her friend Bob. They both have exactly $$$8$$$ cards and there is an integer on each card, ranging from $$$0$$$ to $$$4$$$. In each round, Alice or Bob in turns choose two cards from different players, let them be $$$a$$$ and $$$b$$$, where $$$a$$$ is the number on the pla...
2,600
false
false
false
false
false
false
false
false
false
true
6,051
1455A
Let's define a function $$$f(x)$$$ ($$$x$$$ is a positive integer) as follows: write all digits of the decimal representation of $$$x$$$ backwards, then get rid of the leading zeroes. For example, $$$f(321) = 123$$$, $$$f(120) = 21$$$, $$$f(1000000) = 1$$$, $$$f(111) = 111$$$. Let's define another function $$$g(x) = df...
800
true
false
false
false
false
false
false
false
false
false
3,402
873C
Ivan is playing a strange game. He has a matrix _a_ with _n_ rows and _m_ columns. Each element of the matrix is equal to either 0 or 1. Rows and columns are 1-indexed. Ivan can replace any number of ones in this matrix with zeroes. After that, his score in the game will be calculated as follows: 1. Initially Ivan's sc...
1,600
false
true
false
false
false
false
false
false
false
false
6,252
1817E
You're given a multiset of non-negative integers $$${a_1, a_2, dots, a_n}$$$. In one step you take two elements $$$x$$$ and $$$y$$$ of the multiset, remove them and insert their mean value $$$frac{x + y}{2}$$$ back into the multiset. You repeat the step described above until you are left with only two numbers $$$A$$$ a...
3,400
false
true
false
false
false
false
true
false
false
false
1,369
1043E
Zibi is a competitive programming coach. There are $$$n$$$ competitors who want to be prepared well. The training contests are quite unusualxa0– there are two people in a team, two problems, and each competitor will code exactly one of them. Of course, people in one team will code different problems. Rules of scoring a...
1,900
true
true
false
false
false
true
false
false
true
false
5,479
265A
Problem - 265A - 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,773
847M
Vasya came up with his own weather forecasting method. He knows the information about the average air temperature for each of the last _n_ days. Assume that the average air temperature for each day is integral. Vasya believes that if the average temperatures over the last _n_ days form an arithmetic progression, where ...
1,000
true
false
true
false
false
false
false
false
false
false
6,359
45E
Vasya is a born Berland film director, he is currently working on a new blockbuster, "The Unexpected". Vasya knows from his own experience how important it is to choose the main characters' names and surnames wisely. He made up a list of _n_ names and _n_ surnames that he wants to use. Vasya haven't decided yet how to ...
2,000
false
true
false
false
false
true
false
false
false
false
9,755
1256E
There are $$$n$$$ students at your university. The programming skill of the $$$i$$$-th student is $$$a_i$$$. As a coach, you want to divide them into teams to prepare them for the upcoming ICPC finals. Just imagine how good this university is if it has $$$2 cdot 10^5$$$ students ready for the finals! Each team should c...
2,000
false
true
false
true
false
false
false
false
true
false
4,403
1252G
Randall is a software engineer at a company with $$$N$$$ employees. Every year, the company re-evaluates its employees. At the end of every year, the company replaces its several worst-performing employees and replaces with the same number of new employees, so that the company keeps having $$$N$$$ employees. Each perso...
2,100
false
false
false
false
true
false
false
false
false
false
4,428
628A
A tennis tournament with _n_ participants is running. The participants are playing by an olympic system, so the winners move on and the losers drop out. The tournament takes place in the following way (below, _m_ is the number of the participants of the current round): let _k_ be the maximal power of the number 2 such...
1,000
true
false
true
false
false
false
false
false
false
false
7,315
1288C
Problem - 1288C - 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
false
false
false
true
false
false
false
false
false
false
4,250
1716D
There is a chip on the coordinate line. Initially, the chip is located at the point $$$0$$$. You can perform any number of moves; each move increases the coordinate of the chip by some positive integer (which is called the length of the move). The length of the first move you make should be divisible by $$$k$$$, the le...
2,000
true
false
false
true
false
false
true
false
false
false
1,984
490D
Polycarpus likes giving presents to Paraskevi. He has bought two chocolate bars, each of them has the shape of a segmented rectangle. The first bar is _a_1u2009×u2009_b_1 segments large and the second one is _a_2u2009×u2009_b_2 segments large. Polycarpus wants to give Paraskevi one of the bars at the lunch break and ea...
1,900
true
false
false
false
false
false
true
false
false
false
7,874
1234A
You are both a shop keeper and a shop assistant at a small nearby shop. You have $$$n$$$ goods, the $$$i$$$-th good costs $$$a_i$$$ coins. You got tired of remembering the price of each product when customers ask for it, thus you decided to simplify your life. More precisely you decided to set the same price for all $$...
800
true
false
false
false
false
false
false
false
false
false
4,525
312B
Problem - 312B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,300
true
false
false
false
false
false
false
false
false
false
8,596
52A
Problem - 52A - Codeforces =============== xa0 . The second line contains a sequence of integers _a_1,u2009_a_2,u2009...,u2009_a__n_ (1u2009≤u2009_a__i_u2009≤u20093). Output Print the minimum number of replacements needed to be performed to make all the numbers in the sequence equal. Examples Input 9 1 3 2 2...
900
false
false
true
false
false
false
false
false
false
false
9,713
585B
The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a rectangular field consisting of three rows and _n_ columns. At the beginning of the game the hero is in some cell of the leftm...
1,700
false
false
false
false
false
false
false
false
false
true
7,504
711D
ZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it consists of _n_ towns numbered from 1 to _n_. There are _n_ directed roads in the Udayland. _i_-th of them goes from town _i_ to some other town _a__i_ (_a__i_u2009≠u2009_i_). ZS the Coder can flip the direction of any roa...
1,900
true
false
false
false
false
false
false
false
false
true
6,973
625D
Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder. Let's denote a flip operation of an integer as follows: number is considered ...
2,400
true
false
true
false
false
true
false
false
false
false
7,330
1862C
Anya lives in the Flower City. By order of the city mayor, she has to build a fence for herself. The fence consists of $$$n$$$ planks, each with a height of $$$a_i$$$ meters. According to the order, the heights of the planks must not increase. In other words, it is true that $$$a_i ge a_j$$$ for all $$$i < j$$$. Anya b...
1,100
false
false
true
false
true
false
false
true
true
false
1,111
1931G
You have a one-dimensional puzzle, all the elements of which need to be put in one row, connecting with each other. All the puzzle elements are completely white and distinguishable from each other only if they have different shapes. Each element has straight borders at the top and bottom, and on the left and right it h...
2,000
true
false
false
false
false
false
false
false
false
false
695
1174B
Problem - 1174B - 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,200
false
false
false
false
false
false
false
false
true
false
4,850
1251A
Recently Polycarp noticed that some of the buttons of his keyboard are malfunctioning. For simplicity, we assume that Polycarp's keyboard contains $$$26$$$ buttons (one for each letter of the Latin alphabet). Each button is either working fine or malfunctioning. To check which buttons need replacement, Polycarp pressed...
1,000
false
false
false
false
false
false
true
false
false
false
4,441
580E
One day Kefa the parrot was walking down the street as he was on the way home from the restaurant when he saw something glittering by the road. As he came nearer he understood that it was a watch. He decided to take it to the pawnbroker to earn some money. The pawnbroker said that each watch contains a serial number re...
2,500
false
false
false
false
true
false
false
false
false
false
7,524
1854A1
The only difference between the two versions of this problem is the constraint on the maximum number of operations. 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$$$ of integers (positive, negative or $$$0$$$). You can perform multiple operations on the a...
1,400
true
false
false
false
false
true
false
false
false
false
1,159
1896F
You are given a binary string $$$s$$$ of length $$$2n$$$ where each element is $$$mathtt{0}$$$ or $$$mathtt{1}$$$. You can do the following operation: 1. Choose a balanced bracket sequence$$$^dagger$$$ $$$b$$$ of length $$$2n$$$. 2. For every index $$$i$$$ from $$$1$$$ to $$$2n$$$ in order, where $$$b_i$$$ is an open b...
2,600
true
true
true
false
false
true
false
false
false
false
932
1886D
Monocarp has $$$n$$$ numbers $$$1, 2, dots, n$$$ and a set (initially empty). He adds his numbers to this set $$$n$$$ times in some order. During each step, he adds a new number (which has not been present in the set before). In other words, the sequence of added numbers is a permutation of length $$$n$$$. Every time M...
2,100
true
false
false
false
true
false
false
false
false
false
974
2008D
For a certain permutation $$$p$$$$$$^{ ext{∗}}$$$ Sakurako calls an integer $$$j$$$ reachable from an integer $$$i$$$ if it is possible to make $$$i$$$ equal to $$$j$$$ by assigning $$$i=p_i$$$ a certain number of times. If $$$p=[3,5,6,1,2,4]$$$, then, for example, $$$4$$$ is reachable from $$$1$$$, because: $$$i=1$$$ ...
1,100
true
false
false
true
false
false
false
false
false
true
205
2026D
Problem - 2026D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,900
true
false
true
true
true
false
false
true
false
false
113
1704H2
This is the hard version of this problem. The difference between easy and hard versions is the constraint on $$$k$$$ and the time limit. Notice that you need to calculate the answer for all positive integers $$$n in [1,k]$$$ in this version. You can make hacks only if both versions of the problem are solved. Cirno is p...
3,500
true
false
false
false
false
false
false
false
false
false
2,047
1130C
Alice lives on a flat planet that can be modeled as a square grid of size $$$n imes n$$$, with rows and columns enumerated from $$$1$$$ to $$$n$$$. We represent the cell at the intersection of row $$$r$$$ and column $$$c$$$ with ordered pair $$$(r, c)$$$. Each cell in the grid is either land or water. An example plan...
1,400
false
false
false
false
false
false
true
false
false
false
5,069
466D
Problem - 466D - 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,100
false
false
false
true
false
false
false
false
false
false
7,974
526C
A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with the same task if you were on his place? One day, when he came to his friend Evan, Om Nom didn't find him at home but he...
2,000
true
true
false
false
false
false
true
false
false
false
7,729
202A
This problem's actual name, "Lexicographically Largest Palindromic Subsequence" is too long to fit into the page headline. You are given string _s_ consisting of lowercase English letters only. Find its lexicographically largest palindromic subsequence. We'll call a non-empty string _s_[_p_1_p_2... _p__k_] = _s__p_1_s_...
800
false
true
true
false
false
false
true
true
false
false
9,034
911A
Problem - 911A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,100
false
false
true
false
false
false
false
false
false
false
6,103
1540A
Farmer John has a farm that consists of $$$n$$$ pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weight, where the cows go so fast that they go back in time! However, Farmer John guarantees that...
1,400
false
true
false
false
false
true
false
false
true
true
2,942
614A
Problem - 614A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,500
false
false
true
false
false
false
true
false
false
false
7,382
1628D2
This is the hard version of the problem. The difference is the constraints on $$$n$$$, $$$m$$$ and $$$t$$$. You can make hacks only if all versions of the problem are solved. Alice and Bob are given the numbers $$$n$$$, $$$m$$$ and $$$k$$$, and play a game as follows: The game has a score that Alice tries to maximize, ...
2,400
true
false
false
true
false
false
false
false
false
false
2,471
436C
During the loading of the game "Dungeons and Candies" you are required to get descriptions of _k_ levels from the server. Each description is a map of an _n_u2009×u2009_m_ checkered rectangular field. Some cells of the field contain candies (each cell has at most one candy). An empty cell is denoted as "." on the map, ...
1,800
false
true
false
false
false
false
false
false
false
true
8,095
1572C
You are given a $$$1$$$ by $$$n$$$ pixel image. The $$$i$$$-th pixel of the image has color $$$a_i$$$. For each color, the number of pixels of that color is at most $$$20$$$. You can perform the following operation, which works like the bucket tool in paint programs, on this image: pick a color — an integer from $$$1$...
2,700
false
true
false
true
false
false
false
false
false
false
2,780
592D
Ari the monster is not an ordinary monster. She is the hidden identity of Super M, the Byteforces’ superhero. Byteforces is a country that consists of _n_ cities, connected by _n_u2009-u20091 bidirectional roads. Every road connects exactly two distinct cities, and the whole road system is designed in a way that one is...
2,200
false
false
false
true
false
false
false
false
false
true
7,479
1851E
Alchemist Nastya loves mixing potions. There are a total of $$$n$$$ types of potions, and one potion of type $$$i$$$ can be bought for $$$c_i$$$ coins. Any kind of potions can be obtained in no more than one way, by mixing from several others. The potions used in the mixing process will be consumed. Moreover, no potion...
1,500
false
false
false
true
false
false
false
false
true
true
1,170
1046C
Formula 1 officials decided to introduce new competition. Cars are replaced by space ships and number of points awarded can differ per race. Given the current ranking in the competition and points distribution for the next race, your task is to calculate the best possible ranking for a given astronaut after the next ra...
1,400
false
true
false
false
false
false
false
false
false
false
5,460
1157B
You are given a long decimal number $$$a$$$ consisting of $$$n$$$ digits from $$$1$$$ to $$$9$$$. You also have a function $$$f$$$ that maps every digit from $$$1$$$ to $$$9$$$ to some (possibly the same) digit from $$$1$$$ to $$$9$$$. You can perform the following operation no more than once: choose a non-empty contig...
1,300
false
true
false
false
false
false
false
false
false
false
4,922
1469B
Monocarp had a sequence $$$a$$$ consisting of $$$n + m$$$ integers $$$a_1, a_2, dots, a_{n + m}$$$. He painted the elements into two colors, red and blue; $$$n$$$ elements were painted red, all other $$$m$$$ elements were painted blue. After painting the elements, he has written two sequences $$$r_1, r_2, dots, r_n$$$ ...
1,000
false
true
false
true
false
false
false
false
false
false
3,337
1142A
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through $$$n cdot k$$$ cities. The cities are numerated from $$$1$$$ to $$$n cdot k$$$, the distance between the neighboring cities is exactly $$$1$$$ km. Sergey does not like beetles, he loves burgers. Fortunately for him, there a...
1,700
true
false
false
false
false
false
true
false
false
false
5,013
1328F
You are given the array $$$a$$$ consisting of $$$n$$$ elements and the integer $$$k le n$$$. You want to obtain at least $$$k$$$ equal elements in the array $$$a$$$. In one move, you can make one of the following two operations: Take one of the minimum elements of the array and increase its value by one (more formally...
2,200
false
true
false
false
false
false
false
false
false
false
4,066
369B
Valera loves to participate in competitions. Especially in programming contests. Today he has participated in the contest with his team, consisting of _n_ students (including Valera). This contest was an individual competition, so each student in the team solved problems individually. After the contest was over, Valera...
1,400
true
false
true
false
false
true
false
false
false
false
8,357
1562A
Problem - 1562A - 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
2,820
350B
Valera's finally decided to go on holiday! He packed up and headed for a ski resort. Valera's fancied a ski trip but he soon realized that he could get lost in this new place. Somebody gave him a useful hint: the resort has _n_ objects (we will consider the objects indexed in some way by integers from 1 to _n_), each o...
1,500
false
false
false
false
false
false
false
false
false
true
8,434
809A
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to _n_ computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on t...
1,500
true
false
true
false
false
false
false
false
true
false
6,528
698B
A tree is an undirected connected graph without cycles. Let's consider a rooted undirected tree with _n_ vertices, numbered 1 through _n_. There are many ways to represent such a tree. One way is to create an array with _n_ integers _p_1,u2009_p_2,u2009...,u2009_p__n_, where _p__i_ denotes a parent of vertex _i_ (here,...
1,700
false
false
false
false
false
true
false
false
false
true
7,032
929B
Statement is not available on English language В самолёте есть _n_ рядов мест. Если смотреть на ряды сверху, то в каждом ряду есть 3 места слева, затем проход между рядами, затем 4 центральных места, затем ещё один проход между рядами, а затем ещё 3 места справа. Известно, что некоторые места уже заняты пассажирами. Вс...
1,300
false
false
true
false
false
false
false
false
false
false
5,989
757C
It's that time of the year, Felicity is around the corner and you can see people celebrating all around the Himalayan region. The Himalayan region has _n_ gyms. The _i_-th gym has _g__i_ Pokemon in it. There are _m_ distinct Pokemon types in the Himalayan region numbered from 1 to _m_. There is a special evolution camp...
1,900
false
false
false
false
true
false
false
false
true
false
6,762
1144A
A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz", "r" and "dabcef". The following string are not diverse: "az", "aa", "bad" and "babc". Note that the letters 'a' and 'z' are n...
800
false
false
true
false
false
false
false
false
false
false
5,005
61E
Problem - 61E - 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,900
false
false
false
false
true
false
false
false
false
false
9,666
1658D1
This is the easy version of the problem. The difference in the constraints between both versions is colored below in red. You can make hacks only if all versions of the problem are solved. Marin and Gojou are playing hide-and-seek with an array. Gojou initially performs the following steps: First, Gojou chooses $$$2$$...
1,600
true
false
false
false
false
false
false
false
false
false
2,336
1062A
JATC and his friend Giraffe are currently in their room, solving some problems. Giraffe has written on the board an array $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ of integers, such that $$$1 le a_1 < a_2 < ldots < a_n le 10^3$$$, and then went to the bathroom. JATC decided to prank his friend by erasing some consecutive el...
1,300
false
true
true
false
false
false
false
false
false
false
5,402
355B
Vasya often uses public transport. The transport in the city is of two types: trolleys and buses. The city has _n_ buses and _m_ trolleys, the buses are numbered by integers from 1 to _n_, the trolleys are numbered by integers from 1 to _m_. Public transport is not free. There are 4 types of tickets: 1. A ticket for on...
1,100
false
true
true
false
false
false
false
false
false
false
8,412
1201C
You are given an array $$$a$$$ of $$$n$$$ integers, where $$$n$$$ is odd. You can make the following operation with it: Choose one of the elements of the array (for example $$$a_i$$$) and increase it by $$$1$$$ (that is, replace it with $$$a_i + 1$$$). You want to make the median of the array the largest possible usin...
1,400
true
true
false
false
false
false
false
true
true
false
4,693
1872C
You are given two integers $$$l le r$$$. You need to find positive integers $$$a$$$ and $$$b$$$ such that the following conditions are simultaneously satisfied: $$$l le a + b le r$$$ $$$gcd(a, b) eq 1$$$ or report that they do not exist. $$$gcd(a, b)$$$ denotes the = 3$$$, $$$gcd(8, 9) = 1$$$, $$$gcd(4, 2) = 2$$$. I...
1,100
true
false
false
false
false
false
false
false
false
false
1,049
167B
One must train much to do well on wizardry contests. So, there are numerous wizardry schools and magic fees. One of such magic schools consists of _n_ tours. A winner of each tour gets a huge prize. The school is organised quite far away, so one will have to take all the prizes home in one go. And the bags that you've ...
1,800
true
false
false
true
false
false
false
false
false
false
9,194