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
988E
Problem - 988E - 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
true
false
false
false
false
true
false
false
false
5,759
1697E
You are given $$$n$$$ points on the plane, the coordinates of the $$$i$$$-th point are $$$(x_i, y_i)$$$. No two points have the same coordinates. The distance between points $$$i$$$ and $$$j$$$ is defined as $$$d(i,j) = x_i - x_j + y_i - y_j$$$. For each point, you have to choose a color, represented by an integer from...
2,400
true
true
true
true
false
true
true
false
false
true
2,096
1253C
Tsumugi brought $$$n$$$ delicious sweets to the Light Music Club. They are numbered from $$$1$$$ to $$$n$$$, where the $$$i$$$-th sweet has a sugar concentration described by an integer $$$a_i$$$. Yui loves sweets, but she can eat at most $$$m$$$ sweets each day for health reasons. Days are $$$1$$$-indexed (numbered $$...
1,500
true
true
false
true
false
false
false
false
true
false
4,420
1110C
Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question. Suppose you are given a positive integer $$$a$$$. You want to choose some integer $$$b$$$ from $$$1$$$ to $$$a - 1$$$ inclusive in such a way that the = max_{0 < b < a}{gcd(a oplus b, a > & > b)}.$$$$$$ H...
1,500
true
false
false
false
false
true
false
false
false
false
5,147
227B
Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array. According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requi...
1,100
false
false
true
false
false
false
false
false
false
false
8,929
988F
Polycarp lives on a coordinate line at the point $$$x = 0$$$. He goes to his friend that lives at the point $$$x = a$$$. Polycarp can move only from left to right, he can pass one unit of length each second. Now it's raining, so some segments of his way are in the rain. Formally, it's raining on $$$n$$$ non-intersectin...
2,100
false
false
false
true
false
false
false
false
false
false
5,758
146A
Problem - 146A - 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
9,290
1066D
Maksim has $$$n$$$ objects and $$$m$$$ boxes, each box has size exactly $$$k$$$. Objects are numbered from $$$1$$$ to $$$n$$$ in order from left to right, the size of the $$$i$$$-th object is $$$a_i$$$. Maksim wants to pack his objects into the boxes and he will pack objects by the following algorithm: he takes one of ...
1,800
false
false
true
false
false
false
false
true
false
false
5,378
1875D
You are given an array of $$$n$$$ nonnegative integers $$$a_1, a_2, dots, a_n$$$. Let $$$m$$$ be a variable that is initialized to $$$0$$$, Jellyfish will perform the following operation $$$n$$$ times: select an index $$$i$$$ ($$$1 leq i leq a$$$) and delete $$$a_i$$$ from $$$a$$$. add $$$operatorname{MEX}(a)^{dagger...
1,600
false
false
false
true
false
false
false
false
false
false
1,027
1051G
Suppose you are given a sequence $$$S$$$ of $$$k$$$ pairs of integers $$$(a_1, b_1), (a_2, b_2), dots, (a_k, b_k)$$$. You can perform the following operations on it: 1. Choose some position $$$i$$$ and increase $$$a_i$$$ by $$$1$$$. That can be performed only if there exists at least one such position $$$j$$$ that $$$i...
2,900
false
true
false
false
true
false
false
false
false
false
5,449
613C
Ivan wants to make a necklace as a present to his beloved girl. A necklace is a cyclic sequence of beads of different colors. Ivan says that necklace is beautiful relative to the cut point between two adjacent beads, if the chain of beads remaining after this cut is a palindrome (reads the same forward and backward). I...
2,500
true
false
false
false
false
true
false
false
false
false
7,385
1369F
# BareLee Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Lee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called “Crit...
2,700
false
false
false
true
false
false
false
false
false
false
3,822
696A
Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections _i_ and 2_i_ and another road between _i_ and 2_i_u2009+u20091 for every positive integer _i_. You can clearly see that there exists a unique shortest pa...
1,500
false
false
true
false
true
false
true
false
false
false
7,041
92A
There are _n_ walruses sitting in a circle. All of them are numbered in the clockwise order: the walrus number 2 sits to the left of the walrus number 1, the walrus number 3 sits to the left of the walrus number 2, ..., the walrus number 1 sits to the left of the walrus number _n_. The presenter has _m_ chips. The pres...
800
true
false
true
false
false
false
false
false
false
false
9,517
1968G1
This is the easy version of the problem. In this version $$$l=r$$$. You are given a string $$$s$$$. For a fixed $$$k$$$, consider a division of $$$s$$$ into exactly $$$k$$$ continuous substrings $$$w_1,dots,w_k$$$. Let $$$f_k$$$ be the maximal possible $$$LCP(w_1,dots,w_k)$$$ among all divisions. $$$LCP(w_1,dots,w_m)$$...
1,900
false
false
false
true
true
false
false
true
false
false
494
1436F
Problem - 1436F - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
2,800
true
false
false
false
false
false
false
false
false
false
3,486
250B
An IPv6-address is a 128-bit number. For convenience, this number is recorded in blocks of 16 bits in hexadecimal record, the blocks are separated by colons — 8 blocks in total, each block has four hexadecimal digits. Here is an example of the correct record of a IPv6 address: "0124:5678:90ab:cdef:0124:5678:90ab:cdef"....
1,500
false
false
true
false
false
false
false
false
false
false
8,835
1981B
There is a sequence $$$a_0, a_1, a_2, ldots$$$ of infinite length. Initially $$$a_i = i$$$ for every non-negative integer $$$i$$$. After every second, each element of the sequence will simultaneously change. $$$a_i$$$ will change to $$$a_{i - 1} mid a_i mid a_{i + 1}$$$ for every positive integer $$$i$$$. $$$a_0$$$ wil...
1,300
true
false
false
false
false
false
false
false
false
false
401
274C
Problem - 274C - 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,600
false
false
false
false
false
false
true
false
false
false
8,737
1674A
You are given two integers $$$x$$$ and $$$y$$$. You want to choose two strictly positive (greater than zero) integers $$$a$$$ and $$$b$$$, and then apply the following operation to $$$x$$$ exactly $$$a$$$ times: replace $$$x$$$ with $$$b cdot x$$$. You want to find two positive integers $$$a$$$ and $$$b$$$ such that $$...
800
true
false
false
false
false
true
false
false
false
false
2,229
1764B
Everybody! Doremy's Perfect Math Class is about to start! Come and do your best if you want to have as much IQ as me!" In today's math class, Doremy is teaching everyone subtraction. Now she gives you a quiz to prove that you are paying attention in class. You are given a set $$$S$$$ containing positive integers. You m...
900
true
false
false
false
false
false
false
false
false
false
1,726
1951C
As the CEO of a startup company, you want to reward each of your $$$k$$$ employees with a ticket to the upcoming concert. The tickets will be on sale for $$$n$$$ days, and by some time travelling, you have predicted that the price per ticket at day $$$i$$$ will be $$$a_i$$$. However, to prevent ticket hoarding, the con...
1,400
true
true
false
false
false
false
false
false
true
false
572
721D
Recently Maxim has found an array of _n_ integers, needed by no one. He immediately come up with idea of changing it: he invented positive integer _x_ and decided to add or subtract it from arbitrary array elements. Formally, by applying single operation Maxim chooses integer _i_ (1u2009≤u2009_i_u2009≤u2009_n_) and rep...
2,000
true
true
false
false
true
true
false
false
false
false
6,928
71B
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar. A bar is represented as _n_ squares, located in line. To add clarity, let's number them with positive integers from 1 to _n_ fro...
1,300
true
false
true
false
false
false
false
false
false
false
9,615
275A
Problem - 275A - 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...
900
false
false
true
false
false
false
false
false
false
false
8,734
1054A
Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor $$$x$$$, Egor on the floor $$$y$$$ (not on the same floor with Masha). The house has a staircase and an elevator....
800
false
false
true
false
false
false
false
false
false
false
5,447
314D
Problem - 314D - 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,500
false
false
false
false
true
false
false
true
true
false
8,587
1228B
Suppose there is a $$$h imes w$$$ grid consisting of empty or full cells. Let's make some definitions: $$$r_{i}$$$ is the number of consecutive full cells connected to the left side in the $$$i$$$-th row ($$$1 le i le h$$$). In particular, $$$r_i=0$$$ if the leftmost cell of the $$$i$$$-th row is empty. $$$c_{j}$$$ ...
1,400
true
false
true
false
false
false
false
false
false
false
4,534
704C
Natalia Romanova is trying to test something on the new gun S.H.I.E.L.D gave her. In order to determine the result of the test, she needs to find the number of answers to a certain equation. The equation is of form: Where represents logical OR and represents logical exclusive OR (XOR), and _v__i_,u2009_j_ are some bool...
2,900
true
false
true
true
false
false
false
false
false
true
7,004
1389B
You are given an array $$$a_1, a_2, dots, a_n$$$, consisting of $$$n$$$ positive integers. Initially you are standing at index $$$1$$$ and have a score equal to $$$a_1$$$. You can perform two kinds of moves: 1. move rightxa0— go from your current index $$$x$$$ to $$$x+1$$$ and add $$$a_{x+1}$$$ to your score. This move...
1,600
false
true
false
true
false
false
true
false
false
false
3,727
2006C
Let there be a set that contains distinct positive integers. To expand the set to contain as many integers as possible, Eri can choose two integers $$$x eq y$$$ from the set such that their average $$$frac{x+y}2$$$ is still a positive integer and isn't contained in the set, and add it to the set. The integers $$$x$$$ a...
2,300
true
false
false
false
true
false
false
false
false
false
215
467E
Problem - 467E - 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,300
false
true
false
true
true
false
false
false
false
false
7,968
1808E2
This is the medium version of the problem. The only difference between the three versions is the constraints on $$$n$$$ and $$$k$$$. You can make hacks only if all versions of the problem are solved. Maxim is a minibus driver on Venus. To ride on Maxim's minibus, you need a ticket. Each ticket has a number consisting o...
2,500
false
false
false
true
false
false
false
false
false
false
1,422
522A
One day Polycarp published a funny picture in a social network making a poll about the color of his handle. Many of his friends started reposting Polycarp's joke to their news feed. Some of them reposted the reposts and so on. These events are given as a sequence of strings "name1 reposted name2", where name1 is the na...
1,200
false
false
false
true
false
false
false
false
false
true
7,750
1389G
You are given an undirected connected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. $$$k$$$ vertices of this graph are special. You have to direct each edge of this graph or leave it undirected. If you leave the $$$i$$$-th edge undirected, you pay $$$w_i$$$ coins, and if you direct it, you don't have to pay f...
2,800
false
false
false
true
false
false
false
false
false
true
3,722
1553A
Problem - 1553A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
true
false
false
false
false
false
false
false
false
false
2,875
802N
The marmots need to prepare _k_ problems for HC2 over _n_ days. Each problem, once prepared, also has to be printed. The preparation of a problem on day _i_ (at most one per day) costs _a__i_ CHF, and the printing of a problem on day _i_ (also at most one per day) costs _b__i_ CHF. Of course, a problem cannot be printe...
2,400
false
false
false
false
false
false
false
true
false
true
6,554
1054B
Initially Ildar has an empty array. He performs $$$n$$$ steps. On each step he takes a subset of integers already added to the array and appends the mex of this subset to the array. The mex of an multiset of integers is the smallest non-negative integer not presented in the multiset. For example, the mex of the multise...
1,000
false
false
true
false
false
false
false
false
false
false
5,446
685E
Gerda is travelling to the palace of the Snow Queen. The road network consists of _n_ intersections and _m_ bidirectional roads. Roads are numbered from 1 to _m_. Snow Queen put a powerful spell on the roads to change the weather conditions there. Now, if Gerda steps on the road _i_ at the moment of time less or equal ...
2,800
false
false
false
false
false
false
true
false
false
true
7,079
1139E
There are $$$n$$$ students and $$$m$$$ clubs in a college. The clubs are numbered from $$$1$$$ to $$$m$$$. Each student has a potential $$$p_i$$$ and is a member of the club with index $$$c_i$$$. Initially, each student is a member of exactly one club. A technical fest starts in the college, and it will run for the nex...
2,400
false
false
false
false
false
false
false
false
false
true
5,030
1278B
You are given two integers $$$a$$$ and $$$b$$$. You can perform a sequence of operations: during the first operation you choose one of these numbers and increase it by $$$1$$$; during the second operation you choose one of these numbers and increase it by $$$2$$$, and so on. You choose the number of these operations yo...
1,500
true
true
false
false
false
false
false
false
false
false
4,305
1721A
You have an image file of size $$$2 imes 2$$$, consisting of $$$4$$$ pixels. Each pixel can have one of $$$26$$$ different colors, denoted by lowercase Latin letters. You want to recolor some of the pixels of the image so that all $$$4$$$ pixels have the same color. In one move, you can choose no more than two pixels ...
800
false
true
true
false
false
false
false
false
false
false
1,959
119B
Vasya is about to take his first university exam in about several minutes. And it's not just some ordinary exam, it's on mathematical analysis. Of course, right now Vasya can only think of one thing: what the result of his talk with the examiner will be... To prepare for the exam, one has to study proofs of _n_ theorem...
1,900
false
false
true
false
false
true
false
false
true
false
9,410
1519F
Alice and Bob play a game. Alice has got $$$n$$$ treasure chests (the $$$i$$$-th of which contains $$$a_i$$$ coins) and $$$m$$$ keys (the $$$j$$$-th of which she can sell Bob for $$$b_j$$$ coins). Firstly, Alice puts some locks on the chests. There are $$$m$$$ types of locks, the locks of the $$$j$$$-th type can only b...
3,200
false
false
false
true
false
false
true
false
false
false
3,064
1488J
Your friend is running a flower shop. In order to be prepared for the next holidays (when, as usual, sales skyrocket) she asked you to write her a special program that will help to analyze the stocks she has. There are $$$n$$$ different types of flowers she can order and each flower of the type $$$i$$$ costs $$$w_i$$$....
3,100
true
false
false
false
true
false
false
false
false
false
3,230
1834B
Fedya is playing a new game called "The Legend of Link", in which one of the character's abilities is to combine two materials into one weapon. Each material has its own strength, which can be represented by a positive integer $$$x$$$. The strength of the resulting weapon is determined as the sum of the absolute differ...
1,000
true
true
false
false
false
false
false
false
false
false
1,283
671D
Mayor of Yusland just won the lottery and decided to spent money on something good for town. For example, repair all the roads in the town. Yusland consists of _n_ intersections connected by _n_u2009-u20091 bidirectional roads. One can travel from any intersection to any other intersection using only these roads. There...
2,900
false
true
false
true
true
false
false
false
false
false
7,137
1761B
Define a cyclic sequence of size $$$n$$$ as an array $$$s$$$ of length $$$n$$$, in which $$$s_n$$$ is adjacent to $$$s_1$$$. Muxii has a ring represented by a cyclic sequence $$$a$$$ of size $$$n$$$. However, the ring itself hates equal adjacent elements. So if two adjacent elements in the sequence are equal at any tim...
1,000
false
true
true
false
false
true
false
false
false
false
1,747
1408A
You are given three sequences: $$$a_1, a_2, ldots, a_n$$$; $$$b_1, b_2, ldots, b_n$$$; $$$c_1, c_2, ldots, c_n$$$. For each $$$i$$$, $$$a_i eq b_i$$$, $$$a_i eq c_i$$$, $$$b_i eq c_i$$$. Find a sequence $$$p_1, p_2, ldots, p_n$$$, that satisfy the following conditions: $$$p_i in {a_i, b_i, c_i}$$$ $$$p_i eq p_{(i...
800
false
false
false
false
false
true
false
false
false
false
3,636
1395B
Boboniu likes playing chess with his employees. As we know, no employee can beat the boss in the chess game, so Boboniu has never lost in any round. You are a new applicant for his company. Boboniu will test you with the following chess question: Consider a $$$n imes m$$$ grid (rows are numbered from $$$1$$$ to $$$n$$$...
1,100
false
false
false
false
false
true
false
false
false
false
3,695
88A
Vasya studies music. He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and before C stands H. We will consider the C note in the row's beginning and the C note after...
1,200
false
false
true
false
false
false
true
false
false
false
9,531
1521C
This is an interactive problem! Nastia has a hidden permutation $$$p$$$ of length $$$n$$$ consisting of integers from $$$1$$$ to $$$n$$$. You, for some reason, want to figure out the permutation. To do that, you can give her an integer $$$t$$$ ($$$1 le t le 2$$$), two different indices $$$i$$$ and $$$j$$$ ($$$1 le i, j...
2,000
false
false
false
false
false
true
false
false
false
false
3,053
1732D1
This is the easy version of the problem. The only difference is that in this version there are no "remove" queries. Initially you have a set containing one element — $$$0$$$. You need to handle $$$q$$$ queries of the following types: + $$$x$$$ — add the integer $$$x$$$ to the set. It is guaranteed that this integer is...
1,500
false
false
true
false
true
false
true
false
false
false
1,895
924B
An atom of element X can exist in _n_ distinct states with energies _E_1u2009<u2009_E_2u2009<u2009...u2009<u2009_E__n_. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified description of the scheme. Three distinct states _i_, _j_ and _k_ are selected, where _i_u2009<u2009_j_u...
1,600
false
true
false
false
false
false
false
true
false
false
6,016
576C
Problem - 576C - 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
true
false
false
false
true
false
false
true
false
7,541
1332A
Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell $$$(x,y)$$$ of an infinite grid. According to Alice's theory, cat needs to move: exactly $$$a$$$ steps left: from $$$(u,v)$$$ to $$$(u-1,v)$$$; exactly $$$b$$$ steps right: from...
1,100
true
true
true
false
false
false
false
false
false
false
4,050
1419B
Jett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases. A staircase is a squared figure that consists of square cells. Each staircase consists of an arbitrary number of stairs. If a staircase has...
1,200
true
true
true
false
false
true
true
false
false
false
3,586
1419C
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large). Killjoy's account is already infected and has a rating equal to $$$x$$$. Its rating is constant. There are $$$n$$$ accounts except h...
1,500
true
true
true
false
false
false
false
false
false
false
3,585
1383C
Note that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter $$$y$$$ Koa selects can be any letter from the first $$$20$$$ lowercase letters of English alphabet (read statement for better understanding). You can make hacks in these problem...
3,100
false
false
false
true
false
false
false
false
false
true
3,754
497D
, # Problem A. Gears Input file: stdin Output file: stdout Time limit: 2 seconds Memory limit: 256 megabytes There are two polygons on the plane, A and B. Polygon A rotates around point P , and polygon B rotates around point Q. Each polygon rotates with the constant rotational speed in the clockwise direction around...
2,900
true
false
false
false
false
false
true
false
false
false
7,846
70D
Once a walrus professor Plato asked his programming students to perform the following practical task. The students had to implement such a data structure that would support a convex hull on some set of points _S_. The input to the program had _q_ queries of two types: 1. Add a point with coordinates (_x_,u2009_y_) into...
2,700
false
false
false
false
true
false
false
false
false
false
9,618
1033D
You are given $$$n$$$ integers $$$a_1, a_2, ldots, a_n$$$. Each of $$$a_i$$$ has between $$$3$$$ and $$$5$$$ divisors. Consider $$$a = prod a_i$$$xa0— the product of all input integers. Find the number of divisors of $$$a$$$. As this number may be very large, print it modulo prime number $$$998244353$$$. Input The firs...
2,000
true
false
false
false
false
false
false
false
false
false
5,532
803E
Each evening Roma plays online poker on his favourite website. The rules of poker on this website are a bit strange: there are always two players in a hand, there are no bets, and the winner takes 1 virtual bourle from the loser. Last evening Roma started to play poker. He decided to spend no more than _k_ virtual bour...
2,000
false
false
false
true
false
false
false
false
false
true
6,548
1400E
Problem - 1400E - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
2,200
false
true
false
true
true
false
false
false
false
false
3,668
276C
The little girl loves the problems on array queries very much. One day she came across a rather well-known problem: you've got an array of $$$n$$$ elements (the elements of the array are indexed starting from 1); also, there are $$$q$$$ queries, each one is defined by a pair of integers $$$l_i$$$, $$$r_i$$$ $$$(1 le l_...
1,500
false
true
true
false
true
false
false
false
true
false
8,730
1937B
You are given a $$$2 imes n$$$ grid filled with zeros and ones. Let the number at the intersection of the $$$i$$$-th row and the $$$j$$$-th column be $$$a_{ij}$$$. There is a grasshopper at the top-left cell $$$(1, 1)$$$ that can only jump one cell right or downwards. It wants to reach the bottom-right cell $$$(2, n)$...
1,300
false
true
true
true
false
false
false
false
false
false
661
1485C
Problem - 1485C - 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
true
false
false
false
false
false
true
true
false
false
3,257
152B
One day Vasya went out for a walk in the yard but there weren't any of his friends outside and he had no one to play touch and run. But the boy didn't lose the high spirits and decided to play touch and run with himself. You may ask: "How did he do that?" The answer is simple. Vasya noticed that the yard is a rectangul...
1,300
false
false
true
false
false
false
false
true
false
false
9,268
2023B
It is already the year $$$3024$$$, ideas for problems have long run out, and the olympiad now takes place in a modified individual format. The olympiad consists of $$$n$$$ problems, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th problem has its own score $$$a_i$$$ and a certain parameter $$$b_i$$$ ($$$1 le b_i le n$$...
1,700
false
false
false
true
false
false
false
true
false
true
130
818G
Author note: I think some of you might remember the problem "Two Melodies" from Eductational Codeforces Round 22. Now it's time to make it a bit more difficult! Alice is a composer, and recently she had recorded two tracks that became very popular. Now she has got a lot of fans who are waiting for new tracks. This time...
2,600
false
false
false
false
false
false
false
false
false
true
6,481
1311E
You are given two integers $$$n$$$ and $$$d$$$. You need to construct a rooted binary tree consisting of $$$n$$$ vertices with a root at the vertex $$$1$$$ and the sum of depths of all vertices equals to $$$d$$$. A tree is a connected graph without cycles. A rooted tree has a special vertex called the root. A parent of...
2,200
false
false
false
false
false
true
true
false
false
false
4,139
1508F
Touko's favorite sequence of numbers is a permutation $$$a_1, a_2, dots, a_n$$$ of $$$1, 2, dots, n$$$, and she wants some collection of permutations that are similar to her favorite permutation. She has a collection of $$$q$$$ intervals of the form $$$[l_i, r_i]$$$ with $$$1 le l_i le r_i le n$$$. To create permutatio...
3,500
false
false
false
false
true
false
true
false
false
false
3,131
468E
Problem - 468E - 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...
3,100
true
false
false
true
false
false
false
false
false
false
7,963
949D
Instructors of Some Informatics School make students go to bed. The house contains _n_ rooms, in each room exactly _b_ students were supposed to sleep. However, at the time of curfew it happened that many students are not located in their assigned rooms. The rooms are arranged in a row and numbered from 1 to _n_. Initi...
2,300
false
true
false
false
false
false
true
true
true
false
5,921
512E
Fox Ciel just designed a puzzle game called "Polygon"! It is played using triangulations of a regular _n_-edge polygon. The goal is to transform one triangulation to another by some tricky rules. Triangulation of an _n_-edge poylgon is a set of _n_u2009-u20093 diagonals satisfying the condition that no two diagonals sh...
2,900
false
false
false
false
false
true
false
false
false
false
7,794
1183H
The only difference between the easy and the hard versions is constraints. A subsequence is a string that can be derived from another string by deleting some or no symbols without changing the order of the remaining symbols. Characters to be deleted are not required to go successively, there can be any gaps between the...
1,900
false
false
false
true
false
false
false
false
false
false
4,795
513D2
You need to find a binary tree of size _n_ that satisfies a given set of _c_ constraints. Suppose that the nodes of the unknown binary tree are labeled using a pre-order traversal starting with 1. For the _i_-th constraint you are given two labels, _a__i_ and _b__i_ and a direction, left or right. In case of left direc...
2,600
false
false
false
false
true
true
false
false
false
false
7,788
1383E
Koa the Koala has a binary string $$$s$$$ of length $$$n$$$. Koa can perform no more than $$$n-1$$$ (possibly zero) operations of the following form: In one operation Koa selects positions $$$i$$$ and $$$i+1$$$ for some $$$i$$$ with $$$1 le i < s$$$ and sets $$$s_i$$$ to $$$max(s_i, s_{i+1})$$$. Then Koa deletes positi...
2,800
false
false
false
true
true
false
false
false
false
false
3,752
1902F
You are given a tree consisting of $$$n$$$ vertices. There is an integer written on each vertex; the $$$i$$$-th vertex has integer $$$a_i$$$ written on it. You have to process $$$q$$$ queries. The $$$i$$$-th query consists of three integers $$$x_i$$$, $$$y_i$$$ and $$$k_i$$$. For this query, you have to answer if it is...
2,400
true
false
true
false
true
false
false
false
false
true
898
325E
Problem - 325E - Codeforces =============== xa0 modulo _n_ or node (2·_i_)u2009+u20091 modulo _n_. The last node to be disarmed must be node 0. Node 0 must be disarmed twice, but all other nodes must be disarmed exactly once. Your task is to find any such order and print it. If there is no such order, pri...
2,800
false
true
false
false
false
false
false
false
false
true
8,537
1870B
You are given two arrays of integers — $$$a_1, ldots, a_n$$$ of length $$$n$$$, and $$$b_1, ldots, b_m$$$ of length $$$m$$$. You can choose any element $$$b_j$$$ from array $$$b$$$ ($$$1 leq j leq m$$$), and for all $$$1 leq i leq n$$$ perform $$$a_i = a_i b_j$$$. You can perform any number of such operations. After a...
1,200
true
true
false
false
false
false
false
false
false
false
1,058
328B
Problem - 328B - Codeforces =============== xa0 . Similary, 2 and 5 work the same. There is no other pair of digits with similar effect. He called this effect "Digital Mimicry". Sheldon favourite number is _t_. He wants to have as many instances of _t_ as possible. How many instances he can construct using th...
1,500
false
true
false
false
false
false
false
false
false
false
8,530
1610H
After watching the new over-rated series Squid Game, Mashtali and Soroush decided to hold their own Squid Games! Soroush agreed to be the host and will provide money for the winner's prize, and Mashtali became the Front Man! $$$m$$$ players registered to play in the games to win the great prize, but when Mashtali found...
3,100
false
true
false
false
true
false
false
false
false
false
2,593
1986E
You are given an array of integers $$$a_1, a_2, ldots, a_n$$$ and an integer $$$k$$$. You need to make it beautiful with the least amount of operations. Before applying operations, you can shuffle the array elements as you like. For one operation, you can do the following: Choose an index $$$1 leq i leq n$$$, Make $$...
1,700
true
true
false
false
false
false
false
false
true
false
361
1904E
Those who don't work don't eat. Get the things you want with your own power. But believe, the earnest and serious people are the ones who have the last laugh... But even then, I won't give you a present. —Santa, Hayate no Gotoku! Since Hayate didn't get any Christmas presents from Santa, he is instead left solving a tr...
2,500
false
false
true
false
true
false
false
false
false
true
885
770B
Problem - 770B - Codeforces =============== xa0 ]( "Анонс") — the integer which Anton has. Output Print the positive integer which doesn't exceed _x_ and has the maximum sum of digits. If there are several such integers, print the biggest of them. Printed integer must not contain leading zeros. Examples In...
1,300
true
false
true
false
false
false
false
false
false
false
6,701
863B
Vadim is really keen on travelling. Recently he heard about kayaking activity near his town and became very excited about it, so he joined a party of kayakers. Now the party is ready to start its journey, but firstly they have to choose kayaks. There are 2·_n_ people in the group (including Vadim), and they have exactl...
1,500
false
true
false
false
false
false
true
false
true
false
6,293
1674G
You are given a directed acyclic graph, consisting of $$$n$$$ vertices and $$$m$$$ edges. The vertices are numbered from $$$1$$$ to $$$n$$$. There are no multiple edges and self-loops. Let $$$mathit{in}_v$$$ be the number of incoming edges (indegree) and $$$mathit{out}_v$$$ be the number of outgoing edges (outdegree) o...
2,000
false
false
false
true
false
false
false
false
false
true
2,223
1907D
Polycarp is designing a level for a game. The level consists of $$$n$$$ segments on the number line, where the $$$i$$$-th segment starts at the point with coordinate $$$l_i$$$ and ends at the point with coordinate $$$r_i$$$. The player starts the level at the point with coordinate $$$0$$$. In one move, they can move to...
1,400
false
false
false
false
false
true
false
true
false
false
861
582E
In this problem we consider Boolean functions of four variables _A_,u2009_B_,u2009_C_,u2009_D_. Variables _A_,u2009_B_,u2009_C_ and _D_ are logical and can take values 0 or 1. We will define a function using the following grammar: <expression> ::= <variable> (<expression>) <operator> (<expression>) <variable> ::= 'A' ...
3,000
false
false
false
true
false
false
false
false
false
false
7,513
1558C
You have a permutation: an array $$$a = [a_1, a_2, ldots, a_n]$$$ of distinct integers from $$$1$$$ to $$$n$$$. The length of the permutation $$$n$$$ is odd. You need to sort the permutation in increasing order. In one step, you can choose any prefix of the permutation with an odd length and reverse it. Formally, if $$...
2,000
false
true
false
false
false
true
false
false
false
false
2,840
2028F
Note that the memory limit is unusual. The Cheshire Cat has a riddle for Alice: given $$$n$$$ integers $$$a_1, a_2, ldots, a_n$$$ and a target $$$m$$$, is there a way to insert $$$+$$$ and $$$ imes$$$ into the circles of the expression $$$$$$a_1 circ a_2 circ cdots circ a_n = m$$$$$$ to make it true? We follow the usua...
2,700
false
false
true
true
false
false
true
false
false
false
98
1225E
You are at the top left cell $$$(1, 1)$$$ of an $$$n imes m$$$ labyrinth. Your goal is to get to the bottom right cell $$$(n, m)$$$. You can only move right or down, one cell per step. Moving right from a cell $$$(x, y)$$$ takes you to the cell $$$(x, y + 1)$$$, while moving down takes you to the cell $$$(x + 1, y)$$$...
2,200
false
false
false
true
false
false
false
true
false
false
4,547
1339A
You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the sa...
900
true
false
true
true
false
false
true
false
false
false
4,009
1515I
Phoenix wonders what it is like to rob diamonds from a jewelry store! There are $$$n$$$ types of diamonds. The $$$i$$$-th type has weight $$$w_i$$$ and value $$$v_i$$$. The store initially has $$$a_i$$$ diamonds of the $$$i$$$-th type. Each day, for $$$q$$$ days, one of the following will happen: 1. A new shipment of $...
3,400
false
false
false
false
true
false
false
true
true
false
3,083
1621B
The integers shop sells $$$n$$$ segments. The $$$i$$$-th of them contains all integers from $$$l_i$$$ to $$$r_i$$$ and costs $$$c_i$$$ coins. Tomorrow Vasya will go to this shop and will buy some segments there. He will get all integers that appear in at least one of bought segments. The total cost of the purchase is t...
1,500
false
true
true
false
true
false
false
false
false
false
2,519
128B
One day in the IT lesson Anna and Maria learned about the lexicographic order. String _x_ is lexicographically less than string _y_, if either _x_ is a prefix of _y_ (and _x_u2009≠u2009_y_), or there exists such _i_ (1u2009≤u2009_i_u2009≤u2009_min_(_x_,u2009_y_)), that _x__i_u2009<u2009_y__i_, and for any _j_ (1u2009≤u...
2,100
false
false
true
false
false
true
true
false
false
false
9,369
1450G
Please pay attention to the unusual memory limit in this problem. In a parallel universe, Satan is called "Trygub". For that reason, the letters of his namesake were deleted from the alphabet in ancient times. The government has $$$n$$$ workers standing in a row and numbered with integers from $$$1$$$ to $$$n$$$ from l...
3,500
false
false
false
true
false
false
false
false
false
false
3,431
303D
Problem - 303D - 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,600
true
false
false
false
false
false
false
false
false
false
8,620
727B
Vasily exited from a store and now he wants to recheck the total price of all purchases in his bill. The bill is a string in which the names of the purchases and their prices are printed in a row without any spaces. Check has the format "_name_1_price_1_name_2_price_2..._name__n__price__n_", where _name__i_ (name of th...
1,600
false
false
true
false
false
false
false
false
false
false
6,899