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
496A
Mike is trying rock climbing but he is awful at it. There are _n_ holds on the wall, _i_-th hold is at height _a__i_ off the ground. Besides, let the sequence _a__i_ increase, that is, _a__i_u2009<u2009_a__i_u2009+u20091 for all _i_ from 1 to _n_u2009-u20091; we will call such sequence a track. Mike thinks that the tra...
900
true
false
true
false
false
false
true
false
false
false
7,851
1349B
Slime has a sequence of positive integers $$$a_1, a_2, ldots, a_n$$$. In one operation Orac can choose an arbitrary subsegment $$$[l ldots r]$$$ of this sequence and replace all values $$$a_l, a_{l + 1}, ldots, a_r$$$ to the value of median of $$${a_l, a_{l + 1}, ldots, a_r}$$$. In this problem, for the integer multise...
2,000
true
true
false
false
false
true
false
false
false
false
3,963
2000D
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 966 (Div. 3) 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...
1,200
false
true
true
false
false
false
false
false
false
false
260
1767E
Algebra Flash 2.2 has just been released! Changelog: New gamemode! Thank you for the continued support of the game! Huh, is that it? Slightly disappointed, you boot up the game and click on the new gamemode. It says "Colored platforms". There are $$$n$$$ platforms, numbered from $$$1$$$ to $$$n$$$, placed one after an...
2,500
true
false
false
true
false
false
true
false
false
true
1,693
62D
Arnie the Worm has finished eating an apple house yet again and decided to move. He made up his mind on the plan, the way the rooms are located and how they are joined by corridors. He numbered all the rooms from 1 to _n_. All the corridors are bidirectional. Arnie wants the new house to look just like the previous one...
2,300
false
false
false
false
false
false
false
false
false
true
9,662
1776D
As soon as SWERC starts, your experienced $$$3$$$-person team immediately realizes that the contest features $$$a$$$ easy problems, $$$b$$$ medium problems, and $$$c$$$ hard problems. Solving a problem will take any of you $$$2$$$, $$$3$$$, or $$$4$$$ time units, depending on whether the problem is easy, medium, or har...
2,800
true
true
false
false
false
true
false
false
false
false
1,625
624A
Luke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to stay alive as long as possible. For simplicity we will assume that everything happens on a straight line, the presses are initially at coordinates 0 and _L_, and they move towards each other ...
800
true
false
false
false
false
false
false
false
false
false
7,335
1882B
You have $$$n$$$ sets of integers $$$S_{1}, S_{2}, ldots, S_{n}$$$. We call a set $$$S$$$ attainable, if it is possible to choose some (possibly, none) of the sets $$$S_{1}, S_{2}, ldots, S_{n}$$$ so that $$$S$$$ is equal to their union$$$^{dagger}$$$. If you choose none of $$$S_{1}, S_{2}, ldots, S_{n}$$$, their union...
1,300
false
true
false
false
false
true
true
false
false
false
996
771B
In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?). A group of soldiers is effective if and only if their names ...
1,500
false
true
false
false
false
true
false
false
false
false
6,697
1201A
A class of students wrote a multiple-choice test. There are $$$n$$$ students in the class. The test had $$$m$$$ questions, each of them had $$$5$$$ possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question $$$i$$$ worth $$$a_i$$$ points. Incorrect answers...
900
false
false
true
false
false
false
false
false
false
false
4,695
1927B
Polycarp lost the string $$$s$$$ of length $$$n$$$ consisting of lowercase Latin letters, but he still has its trace. The trace of the string $$$s$$$ is an array $$$a$$$ of $$$n$$$ integers, where $$$a_i$$$ is the number of such indices $$$j$$$ ($$$j < i$$$) that $$$s_i=s_j$$$. For example, the trace of the string abra...
900
false
true
false
false
false
true
false
false
false
false
729
1369B
# AccurateLee Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Lee was cleaning his house for the party when he found a messy string under the carpets. Now he’d like to make it clean accurately and in a stylish way. . . The string s he found is a binary stri...
1,200
false
true
true
false
false
false
false
false
false
false
3,826
1033E
Bob has a simple undirected connected graph (without self-loops and multiple edges). He wants to learn whether his graph is bipartite (that is, you can paint all vertices of the graph into two colors so that there is no edge connecting two vertices of the same color) or not. As he is not very good at programming, he as...
2,800
false
false
false
false
false
true
false
true
false
true
5,531
1711A
You are given a positive integer $$$n$$$. The weight of a permutation $$$p_1, p_2, ldots, p_n$$$ is the number of indices $$$1le ile n$$$ such that $$$i$$$ divides $$$p_i$$$. Find a permutation $$$p_1,p_2,dots, p_n$$$ with the minimum possible weight (among all permutations of length $$$n$$$). A permutation is an array...
800
false
false
false
false
false
true
false
false
false
false
2,015
570E
Peppa the Pig was walking and walked into the forest. What a strange coincidence! The forest has the shape of a rectangle, consisting of _n_ rows and _m_ columns. We enumerate the rows of the rectangle from top to bottom with numbers from 1 to _n_, and the columns β€” from left to right with numbers from 1 to _m_. Let's ...
2,300
false
false
false
true
false
false
false
false
false
false
7,567
1000A
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners. The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are...
1,200
false
true
true
false
false
false
false
false
false
false
5,705
1290E
Ildar is the algorithm teacher of William and Harris. Today, Ildar is teaching Cartesian Tree. However, Harris is sick, so Ildar is only teaching William. A cartesian tree is a rooted tree, that can be constructed from a sequence of distinct integers. We build the cartesian tree as follows: 1. If the sequence is empty,...
3,300
false
false
false
false
true
false
false
false
false
false
4,242
899E
Vasya has an array of integers of length _n_. Vasya performs the following operations on the array: on each step he finds the longest segment of consecutive equal integers (the leftmost, if there are several such segments) and removes it. For example, if Vasya's array is [13,u200913,u20097,u20097,u20097,u20092,u20092,u...
2,000
false
false
true
false
true
false
false
false
false
false
6,148
1554E
You are given a tree with $$$n$$$ nodes. As a reminder, a tree is a connected undirected graph without cycles. Let $$$a_1, a_2, ldots, a_n$$$ be a sequence of integers. Perform the following operation exactly $$$n$$$ times: Select an unerased node $$$u$$$. Assign $$$a_u :=$$$ number of unerased nodes adjacent to $$$u$...
2,600
true
false
false
true
false
false
false
false
false
false
2,862
1578B
There are $$$n$$$ villages lying equidistant on a circle in the middle of a thick, impassable forest. From ancient times, it was impossible to move from one village to another, but technical progress has changed a lot. Now, there is a technology to build passable trails in the forest. The building process consists of $...
2,800
false
false
false
false
true
false
false
false
false
false
2,753
835C
The Cartesian coordinate system is set in the sky. There you can see _n_ stars, the _i_-th has coordinates (_x__i_, _y__i_), a maximum brightness _c_, equal for all stars, and an initial brightness _s__i_ (0u2009≀u2009_s__i_u2009≀u2009_c_). Over time the stars twinkle. At moment 0 the _i_-th star has brightness _s__i_....
1,600
false
false
true
true
false
false
false
false
false
false
6,425
1734C
You are given a set $$$S$$$, which contains the first $$$n$$$ positive integers: $$$1, 2, ldots, n$$$. You can perform the following operation on $$$S$$$ any number of times (possibly zero): Choose a positive integer $$$k$$$ where $$$1 le k le n$$$, such that there exists a multiple of $$$k$$$ in $$$S$$$. Then, delete...
1,200
true
true
false
false
false
false
false
false
false
false
1,884
1492A
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool. It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the fir...
800
true
false
false
false
false
false
false
false
false
false
3,213
1632D
New Year is just around the corner, which means that in School 179, preparations for the concert are in full swing. There are $$$n$$$ classes in the school, numbered from $$$1$$$ to $$$n$$$, the $$$i$$$-th class has prepared a scene of length $$$a_i$$$ minutes. As the main one responsible for holding the concert, Idnar...
2,000
true
true
false
false
true
false
false
true
false
false
2,455
542E
Vova and Marina love offering puzzles to each other. Today Marina offered Vova to cope with the following task. Vova has a non-directed graph consisting of _n_ vertices and _m_ edges without loops and multiple edges. Let's define the operation of contraction two vertices _a_ and _b_ that are not connected by an edge. A...
2,600
false
false
false
false
false
false
false
false
false
true
7,671
1353D
You are given an array $$$a$$$ of length $$$n$$$ consisting of zeros. You perform $$$n$$$ actions with this array: during the $$$i$$$-th action, the following sequence of operations appears: 1. Choose the maximum by length subarray (continuous subsegment) consisting only of zeros, among all such segments choose the lef...
1,600
false
false
false
false
true
true
false
false
true
false
3,942
1923E
You are given a tree, consisting of $$$n$$$ vertices, numbered from $$$1$$$ to $$$n$$$. Every vertex is colored in some color, denoted by an integer from $$$1$$$ to $$$n$$$. A simple path of the tree is called beautiful if: it consists of at least $$$2$$$ vertices; the first and the last vertices of the path have the...
2,000
false
false
false
true
true
false
false
false
false
true
748
1935E
The New Year has arrived in the Master's Assistance Center, which means it's time to introduce a new feature! Now students are given distance learning courses, with a total of $$$n$$$ courses available. For the $$$i$$$-th distance learning course, a student can receive a grade ranging from $$$x_i$$$ to $$$y_i$$$. Howev...
2,400
true
true
false
false
true
false
true
false
false
false
670
755D
PolandBall has such a convex polygon with _n_ veritces that no three of its diagonals intersect at the same point. PolandBall decided to improve it and draw some red segments. He chose a number _k_ such that _gcd_(_n_,u2009_k_)u2009=u20091. Vertices of the polygon are numbered from 1 to _n_ in a clockwise way. PolandBa...
2,000
false
false
false
false
true
false
false
false
false
false
6,774
1454F
You are given an array $$$a$$$ consisting of $$$n$$$ integers. Let $$$min(l, r)$$$ be the minimum value among $$$a_l, a_{l + 1}, ldots, a_r$$$ and $$$max(l, r)$$$ be the maximum value among $$$a_l, a_{l + 1}, ldots, a_r$$$. Your task is to choose three positive (greater than $$$0$$$) integers $$$x$$$, $$$y$$$ and $$$z$...
2,100
false
true
false
false
true
false
false
true
false
false
3,403
1642B
Sam is a kindergartener, and there are $$$n$$$ children in his group. He decided to create a team with some of his children to play "brawl:go 2". Sam has $$$n$$$ power-ups, the $$$i$$$-th has type $$$a_i$$$. A child's strength is equal to the number of different types among power-ups he has. For a team of size $$$k$$$,...
900
false
true
false
false
false
false
false
false
false
false
2,402
44E
Problem - 44E - 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,400
false
false
false
true
false
false
false
false
false
false
9,765
346A
Problem - 346A - 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
false
false
false
false
false
false
false
false
8,449
1713D
This is an interactive problem. There was a tournament consisting of $$$2^n$$$ contestants. The $$$1$$$-st contestant competed with the $$$2$$$-nd, the $$$3$$$-rd competed with the $$$4$$$-th, and so on. After that, the winner of the first match competed with the winner of second match, etc. The tournament ended when t...
1,800
false
true
false
false
false
true
false
false
false
false
2,003
93E
Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible. One day, as he was reading the game's forum ye...
2,600
true
false
false
true
false
false
false
false
false
false
9,511
377C
Kostya is a progamer specializing in the discipline of Dota 2. Valve Corporation, the developer of this game, has recently released a new patch which turned the balance of the game upside down. Kostya, as the captain of the team, realizes that the greatest responsibility lies on him, so he wants to resort to the analys...
2,200
false
false
false
true
false
false
false
false
false
false
8,322
1998E1
Drink water. β€” Sun Tzu, The Art of Becoming a Healthy Programmer This is the easy version of the problem. The only difference is that $$$x=n$$$ in this version. You must solve both versions to be able to hack. You are given two integers $$$n$$$ and $$$x$$$ ($$$x=n$$$). There are $$$n$$$ balls lined up in a row, numbere...
2,200
false
true
false
false
true
false
true
true
false
false
273
1511A
You are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to pressxa0β€” upvote and downvote. However, the site is not so simple on the inside. There are two servers, each with its separate counts for the upvotes and the downvotes. $$$n$$...
800
false
true
false
false
false
false
false
false
false
false
3,116
1073D
XXI Berland Annual Fair is coming really soon! Traditionally fair consists of $$$n$$$ booths, arranged in a circle. The booths are numbered $$$1$$$ through $$$n$$$ clockwise with $$$n$$$ being adjacent to $$$1$$$. The $$$i$$$-th booths sells some candies for the price of $$$a_i$$$ burles per item. Each booth has an unl...
1,700
false
true
false
false
true
false
true
true
false
false
5,350
1530C
You and your friend Ilya are participating in an individual programming contest consisting of multiple stages. A contestant can get between $$$0$$$ and $$$100$$$ points, inclusive, for each stage, independently of other contestants. Points received by contestants in different stages are used for forming overall contest...
1,200
false
true
false
false
false
false
true
true
true
false
3,013
1423K
In number world, two different numbers are friends if they have a lot in common, but also each one has unique perks. More precisely, two different numbers $$$a$$$ and $$$b$$$ are friends if $$$gcd(a,b)$$$, $$$frac{a}{gcd(a,b)}$$$, $$$frac{b}{gcd(a,b)}$$$ can form sides of a triangle. Three numbers $$$a$$$, $$$b$$$ and ...
1,600
true
false
false
false
false
false
false
true
false
false
3,553
1385B
Problem - 1385B - 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
true
false
false
false
false
false
false
false
false
3,746
1157E
You are given two arrays $$$a$$$ and $$$b$$$, both of length $$$n$$$. All elements of both arrays are from $$$0$$$ to $$$n-1$$$. You can reorder elements of the array $$$b$$$ (if you want, you may leave the order of elements as it is). After that, let array $$$c$$$ be the array of length $$$n$$$, the $$$i$$$-th element...
1,700
false
true
false
false
true
false
false
true
false
false
4,918
982A
Problem - 982A - 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
false
false
false
false
false
true
true
false
false
false
5,792
1005F
There are $$$n$$$ cities in Berland. Some pairs of cities are connected by roads. All roads are bidirectional. Each road connects two different cities. There is at most one road between a pair of cities. The cities are numbered from $$$1$$$ to $$$n$$$. It is known that, from the capital (the city with the number $$$1$$...
2,100
false
false
false
false
false
false
true
false
false
true
5,656
1637B
Problem - 1637B - Codeforces =============== xa0 ,$$$$$$ where $$$operatorname{mex}$$$ of a set of numbers $$$S$$$ is the smallest non-negative integer that does not occur in the set $$$S$$$. In other words, the cost of a partition is the number of segments plus the sum of MEX over all segments. Let's def...
1,100
true
true
false
true
false
false
true
false
false
false
2,433
1140G
You are given a special undirected graph. It consists of $$$2n$$$ vertices numbered from $$$1$$$ to $$$2n$$$. The following properties hold for the graph: there are exactly $$$3n-2$$$ edges in the graph: $$$n$$$ edges connect vertices having odd numbers with vertices having even numbers, $$$n - 1$$$ edges connect vert...
2,700
false
false
false
false
true
false
false
false
false
false
5,022
279A
Problem - 279A - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,400
false
false
true
false
false
false
true
false
false
false
8,720
1967D
Little R is a magician who likes non-decreasing arrays. She has an array of length $$$n$$$, initially as $$$a_1, ldots, a_n$$$, in which each element is an integer between $$$[1, m]$$$. She wants it to be non-decreasing, i.e., $$$a_1 leq a_2 leq ldots leq a_n$$$. To do this, she can perform several magic tricks. Little...
2,800
false
false
true
false
false
false
false
true
false
true
504
1657A
There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer). Your task is to determine the ...
800
true
false
false
false
false
false
true
false
false
false
2,345
958C2
Heidi has now broken the first level of encryption of the Death Star plans, and is staring at the screen presenting her with the description of the next code she has to enter. It looks surprisingly similar to the first one – seems like the Empire engineers were quite lazy... Heidi is once again given a sequence _A_, bu...
2,000
false
false
false
true
false
false
false
false
false
false
5,887
707C
Problem - 707C - 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
true
false
false
false
false
false
false
false
false
false
6,992
1583E
She does her utmost to flawlessly carry out a person's last rites and preserve the world's balance of yin and yang. Hu Tao, being the little prankster she is, has tried to scare you with this graph problem! You are given a connected undirected graph of $$$n$$$ nodes with $$$m$$$ edges. You also have $$$q$$$ queries. Ea...
2,200
false
true
false
false
false
true
false
false
false
true
2,713
2041D
Image generated by ChatGPT 4o. You are given a two-dimensional maze with a start and end position. Your task is to find the fastest way to get from the start to the end position. The fastest way is to make the minimum number of steps where one step is going left, right, up, or down. Of course, you cannot walk through w...
1,700
false
false
false
false
false
false
true
false
false
true
10
1360E
Polygon is not only the best platform for developing problems but also a square matrix with side $$$n$$$, initially filled with the character 0. On the polygon, military training was held. The soldiers placed a cannon above each cell in the first row and a cannon to the left of each cell in the first column. Thus, exac...
1,300
false
false
true
true
false
false
false
false
false
true
3,881
186A
Problem - 186A - 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
9,099
1090C
Santa has prepared boxes with presents for $$$n$$$ kids, one box for each kid. There are $$$m$$$ kinds of presents: balloons, sweets, chocolate bars, toy cars... A child would be disappointed to receive two presents of the same kind, so all kinds of presents in one box are distinct. Having packed all the presents, Sant...
2,400
false
false
false
false
true
true
false
false
false
false
5,270
1194D
Problem - 1194D - 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
false
false
false
false
4,733
920A
It is winter now, and Max decided it's about time he watered the garden. The garden can be represented as _n_ consecutive garden beds, numbered from 1 to _n_. _k_ beds contain water taps (_i_-th tap is located in the bed _x__i_), which, if turned on, start delivering water to neighbouring beds. If the tap on the bed _x...
1,000
false
false
true
false
false
false
false
false
false
false
6,050
258E
The Little Elephant loves trees very much, he especially loves root trees. He's got a tree consisting of _n_ nodes (the nodes are numbered from 1 to _n_), with root at node number 1. Each node of the tree contains some list of numbers which initially is empty. The Little Elephant wants to apply _m_ operations. On the _...
2,400
false
false
false
false
true
false
false
false
false
false
8,798
1613B
You are given a sequence $$$a_1, a_2, dots, a_n$$$ consisting of $$$n$$$ pairwise distinct positive integers. Find $$$leftlfloor frac n 2 ight floor$$$ different pairs of integers $$$x$$$ and $$$y$$$ such that: $$$x eq y$$$; $$$x$$$ and $$$y$$$ appear in $$$a$$$; $$$x~mod~y$$$ doesn't appear in $$$a$$$. Note that ...
1,000
false
true
true
false
false
false
false
false
true
false
2,575
1729A
Vlad went into his appartment house entrance, now he is on the $$$1$$$-th floor. He was going to call the elevator to go up to his apartment. There are only two elevators in his house. Vlad knows for sure that: the first elevator is currently on the floor $$$a$$$ (it is currently motionless), the second elevator is l...
800
true
false
false
false
false
false
false
false
false
false
1,918
73C
Vasya plays the LionAge II. He was bored of playing with a stupid computer, so he installed this popular MMORPG, to fight with his friends. Vasya came up with the name of his character β€” non-empty string _s_, consisting of a lowercase Latin letters. However, in order not to put up a front of friends, Vasya has decided ...
1,800
false
false
false
true
false
false
false
false
false
false
9,600
1638E
Problem - 1638E - 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,400
false
false
true
false
true
false
true
false
false
false
2,422
1866C
Pak Chanek has a directed acyclic graph (a directed graph that does not have any cycles) containing $$$N$$$ vertices. Vertex $$$i$$$ has $$$S_i$$$ edges directed away from that vertex. The $$$j$$$-th edge of vertex $$$i$$$ that is directed away from it, is directed towards vertex $$$L_{i,j}$$$ and has an integer $$$W_{...
1,900
false
false
false
true
false
false
false
false
false
true
1,086
622B
Problem - 622B - Codeforces =============== xa0 ]( "Educational Codeforces Round 7") . The hours and the minutes are given with two digits (the hours or the minutes less than 10 are given with the leading zeroes). The second line contains integer _a_ (0u2009≀u2009_a_u2009≀u2009104) β€” the number of the minu...
900
false
false
true
false
false
false
false
false
false
false
7,345
1857C
Sasha has an array $$$a$$$ of $$$n$$$ integers. He got bored and for all $$$i$$$, $$$j$$$ ($$$i < j$$$), he wrote down the minimum value of $$$a_i$$$ and $$$a_j$$$. He obtained a new array $$$b$$$ of size $$$frac{ncdot (n-1)}{2}$$$. For example, if $$$a=$$$ [$$$2,3,5,1$$$], he would write [$$$min(2, 3), min(2, 5), min(...
1,200
false
true
false
false
false
false
false
false
true
false
1,142
1697D
This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If you use some other programming language, consult its documentation. You m...
1,900
false
false
false
false
false
true
false
true
false
false
2,097
1287A
It's a walking tour day in SIS.Winter, so $$$t$$$ groups of students are visiting Torzhok. Streets of Torzhok are so narrow that students have to go in a row one after another. Initially, some students are angry. Let's describe a group of students by a string of capital letters "A" and "P": "A" corresponds to an angry...
800
false
true
true
false
false
false
false
false
false
false
4,254
212B
We'll call string _s_[_a_,u2009_b_]u2009=u2009_s__a__s__a_u2009+u20091... _s__b_ (1u2009≀u2009_a_u2009≀u2009_b_u2009≀u2009_s_) a substring of string _s_u2009=u2009_s_1_s_2... _s__s_, where _s_ is the length of string _s_. The trace of a non-empty string _t_ is a set of characters that the string consists of. For exampl...
2,300
false
false
true
false
false
false
false
false
false
false
8,992
842A
Problem - 842A - 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
false
false
false
false
false
false
true
false
false
false
6,396
526F
In this problem you will meet the simplified model of game Pudding Monsters. An important process in developing any game is creating levels. A game field in Pudding Monsters is an _n_u2009Γ—u2009_n_ rectangular grid, _n_ of its cells contain monsters and some other cells contain game objects. The gameplay is about movin...
3,000
false
false
false
false
true
false
false
false
false
false
7,726
1165A
You are given a huge decimal number consisting of $$$n$$$ digits. It is guaranteed that this number has no leading zeros. Each digit of this number is either 0 or 1. You may perform several (possibly zero) operations with this number. During each operation you are allowed to change any digit of your number; you may cha...
1,100
true
false
true
false
false
false
false
false
false
false
4,896
144B
The Super Duper Secret Meeting of the Super Duper Secret Military Squad takes place in a Super Duper Secret Place. The place is an infinite plane with introduced Cartesian coordinate system. The meeting table is represented as a rectangle whose sides are parallel to the coordinate axes and whose vertexes are located at...
1,300
false
false
true
false
false
false
false
false
false
false
9,299
1313B
Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $$$n$$$ participants, one of whom is Nikolay. Like any good olympiad, it consists of two rounds. Tired of the traditional rules, in which the participant who solved the larges...
1,700
true
true
true
false
false
true
false
false
false
false
4,129
120J
You are given a set of _n_ vectors on a plane. For each vector you are allowed to multiply any of its coordinates by -1. Thus, each vector _v__i_u2009=u2009(_x__i_,u2009_y__i_) can be transformed into one of the following four vectors: _v__i_1u2009=u2009(_x__i_,u2009_y__i_), _v__i_2u2009=u2009(u2009-u2009_x__i_,u2009...
1,900
false
false
false
false
false
false
false
false
true
false
9,397
1486D
Problem - 1486D - 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,100
false
false
false
true
true
false
false
true
false
false
3,249
1909I
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Pinely Round 3 (Div. 1 + 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....
1,900
true
false
false
true
false
false
false
false
false
false
848
1558B
Note that the memory limit in this problem is lower than in others. You have a vertical strip with $$$n$$$ cells, numbered consecutively from $$$1$$$ to $$$n$$$ from top to bottom. You also have a token that is initially placed in cell $$$n$$$. You will move the token up until it arrives at cell $$$1$$$. Let the token ...
1,900
true
false
false
true
false
false
true
false
false
false
2,841
1739B
Problem - 1739B - 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,100
true
true
false
false
false
true
false
false
false
false
1,852
1537E1
This is the easy version of the problem. The only difference is the constraints on $$$n$$$ and $$$k$$$. You can make hacks only if all versions of the problem are solved. You have a string $$$s$$$, and you can do two types of operations on it: Delete the last character of the string. Duplicate the string: $$$s:=s+s$$...
1,600
false
true
true
true
false
false
true
true
false
false
2,958
864B
Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string _s_ consisting only of lowercase and uppercase Latin letters. Let _A_ be a set of positions in the string. Let's call it pretty if following conditions are met: letters on positions from _A_ in the string are all distinct and lowercase;...
1,000
false
false
true
false
false
false
true
false
false
false
6,286
1065A
There is a special offer in Vasya's favourite supermarket: if the customer buys $$$a$$$ chocolate bars, he or she may take $$$b$$$ additional bars for free. This special offer can be used any number of times. Vasya currently has $$$s$$$ roubles, and he wants to get as many chocolate bars for free. Each chocolate bar co...
800
true
false
true
false
false
false
false
false
false
false
5,388
765A
There are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some reason they prefer name "snookah")! When a competition takes place somewhere far from their hometown, Ivan, Artsem and Konstantin take a flight to the contest and back. Jinotega's best friends, team B...
900
true
false
true
false
false
false
false
false
false
false
6,730
1852A
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 887 (Div. 1) 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...
1,800
true
false
false
false
false
false
false
true
false
false
1,167
587C
Recently Duff has been a soldier in the army. Malek is her commander. Their country, Andarz Gu has _n_ cities (numbered from 1 to _n_) and _n_u2009-u20091 bidirectional roads. Each road connects two different cities. There exist a unique path between any two cities. There are also _m_ people living in Andarz Gu (number...
2,200
false
false
false
false
true
false
false
false
false
false
7,495
1146F
You are given a rooted tree with $$$n$$$ nodes, labeled from $$$1$$$ to $$$n$$$. The tree is rooted at node $$$1$$$. The parent of the $$$i$$$-th node is $$$p_i$$$. A leaf is node with no children. For a given set of leaves $$$L$$$, let $$$f(L)$$$ denote the smallest connected subgraph that contains all leaves $$$L$$$....
2,500
false
false
false
true
false
false
false
false
false
false
4,986
1628D1
This is the easy 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,100
true
false
false
true
false
false
false
false
false
false
2,472
248B
Problem - 248B - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,400
true
false
false
false
false
false
false
false
false
false
8,842
1044D
There is an array $$$a$$$ of $$$2^{30}$$$ integers, indexed from $$$0$$$ to $$$2^{30}-1$$$. Initially, you know that $$$0 leq a_i < 2^{30}$$$ ($$$0 leq i < 2^{30}$$$), but you do not know any of the values. Your task is to process queries of two types: 1 l r x: You are informed that the bitwise xor of the subarray $$$...
2,400
false
false
false
false
true
false
false
false
false
false
5,473
1574D
Ivan is playing yet another roguelike computer game. He controls a single hero in the game. The hero has $$$n$$$ equipment slots. There is a list of $$$c_i$$$ items for the $$$i$$$-th slot, the $$$j$$$-th of them increases the hero strength by $$$a_{i,j}$$$. The items for each slot are pairwise distinct and are listed ...
2,000
false
true
true
false
true
false
true
true
false
true
2,771
228D
The court wizard Zigzag wants to become a famous mathematician. For that, he needs his own theorem, like the Cauchy theorem, or his sum, like the Minkowski sum. But most of all he wants to have his sequence, like the Fibonacci sequence, and his function, like the Euler's totient function. The Zigag's sequence with the ...
2,100
false
false
false
false
true
false
false
false
false
false
8,925
1635C
You are given an array $$$a$$$ of $$$n$$$ elements. Your can perform the following operation no more than $$$n$$$ times: Select three indices $$$x,y,z$$$ $$$(1 leq x < y < z leq n)$$$ and replace $$$a_x$$$ with $$$a_y - a_z$$$. After the operation, $$$a_x$$$ need to be less than $$$10^{18}$$$. Your goal is to make the ...
1,200
false
true
false
false
false
true
false
false
false
false
2,438
1742B
Problem - 1742B - 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
true
true
false
false
false
false
false
true
false
1,830
1936A
This is an interactive problem. There is a secret sequence $$$p_0, p_1, ldots, p_{n-1}$$$, which is a permutation of $$${0,1,ldots,n-1}$$$. You need to find any two indices $$$i$$$ and $$$j$$$ such that $$$p_i oplus p_j$$$ is maximized, where $$$oplus$$$ denotes the . Next, the jury calculates $$$x = (p_a mid p_b)$$$ a...
1,700
true
true
false
false
false
true
false
false
false
false
668
1139A
You are given a string $$$s=s_1s_2dots s_n$$$ of length $$$n$$$, which only contains digits $$$1$$$, $$$2$$$, ..., $$$9$$$. A substring $$$s[l dots r]$$$ of $$$s$$$ is a string $$$s_l s_{l + 1} s_{l + 2} ldots s_r$$$. A substring $$$s[l dots r]$$$ of $$$s$$$ is called even if the number represented by it is even. Find ...
800
false
false
true
false
false
false
false
false
false
false
5,034
552C
Vanya has a scales for weighing loads and weights of masses _w_0,u2009_w_1,u2009_w_2,u2009...,u2009_w_100 grams where _w_ is some integer not less than 2 (exactly one weight of each nominal value). Vanya wonders whether he can weight an item with mass _m_ using the given weights, if the weights can be put on both pans ...
1,900
true
true
false
true
false
false
true
false
false
false
7,625
1986G1
This is a simple version of the problem. The only difference is that in this version $$$n leq 10^5$$$ and the sum of $$$n$$$ for all sets of input data does not exceed $$$10^5$$$. You are given a permutation $$$p$$$ of length $$$n$$$. Calculate the number of index pairs $$$1 leq i < j leq n$$$ such that $$$p_i cdot p_j...
2,200
true
false
false
false
true
false
true
true
false
false
359
74A
Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document. In the beginning of the round the contestants are divided into rooms. Each room contains exactly _n_ participants. During the contest the participants are suggested to solve five probl...
1,000
false
false
true
false
false
false
false
false
false
false
9,596
333A
Gerald has been selling state secrets at leisure. All the secrets cost the same: _n_ marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denominations that are powers of three: 1 mark, 3 marks, 9 marks, 27 marks and so on. There are no coins of o...
1,600
false
true
false
false
false
false
false
false
false
false
8,505