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
497E
Assume that _s__k_(_n_) equals the sum of digits of number _n_ in the _k_-based notation. For example, _s_2(5)u2009=u2009_s_2(1012)u2009=u20091u2009+u20090u2009+u20091u2009=u20092, _s_3(14)u2009=u2009_s_3(1123)u2009=u20091u2009+u20091u2009+u20092u2009=u20094. The sequence of integers _a_0,u2009...,u2009_a__n_u2009-u200...
2,900
false
false
false
true
false
false
false
false
false
false
7,845
1102B
You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers. You have to color this array in $$$k$$$ colors in such a way that: Each element of the array should be colored in some color; For each $$$i$$$ from $$$1$$$ to $$$k$$$ there should be at least one element colored in the $$$i$$$-th color in the array...
1,400
false
true
false
false
false
false
false
false
true
false
5,192
1987C
There are $$$n$$$ flowers in a row, the $$$i$$$-th of them initially has a positive height of $$$h_i$$$ meters. Every second, the wind will blow from the left, causing the height of some flowers to decrease. Specifically, every second, for each $$$i$$$ from $$$1$$$ to $$$n$$$, in this order, the following happens: If ...
1,200
false
true
false
true
false
false
false
false
false
false
355
1324E
Vova had a pretty weird sleeping schedule. There are $$$h$$$ hours in a day. Vova will sleep exactly $$$n$$$ times. The $$$i$$$-th time he will sleep exactly after $$$a_i$$$ hours from the time he woke up. You can assume that Vova woke up exactly at the beginning of this story (the initial time is $$$0$$$). Each time V...
1,700
false
false
true
true
false
false
false
false
false
false
4,095
87C
Problem - 87C - 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...
2,000
true
false
false
true
false
false
false
false
false
false
9,534
1238C
You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height $$$h$$$, and there is a moving platform on each height $$$x$$$ from $$$1$$$ to $$$h$$$. Each platform is either hidden inside the cliff or moved out. At first, there ar...
1,600
true
true
false
true
false
false
false
false
false
false
4,501
416D
Polycarpus develops an interesting theory about the interrelation of arithmetic progressions with just everything in the world. His current idea is that the population of the capital of Berland changes over time like an arithmetic progression. Well, or like multiple arithmetic progressions. Polycarpus believes that if ...
2,400
true
true
true
false
false
false
false
false
false
false
8,159
1559A
Mocha is a young girl from high school. She has learned so much interesting knowledge from her teachers, especially her math teacher. Recently, Mocha is learning about binary system and very interested in bitwise operation. This day, Mocha got a sequence $$$a$$$ of length $$$n$$$. In each operation, she can select an a...
900
true
false
false
false
false
true
false
false
false
false
2,836
1794E
You are given an unweighted tree of $$$n$$$ vertices numbered from $$$1$$$ to $$$n$$$ and a list of $$$n-1$$$ integers $$$a_1, a_2, ldots, a_{n-1}$$$. A tree is a connected undirected graph without cycles. You will use each element of the list to label one vertex. No vertex should be labeled twice. You can label the on...
2,400
false
true
true
true
true
false
false
false
false
false
1,510
2038A
There is a team of $$$n$$$ software engineers numbered from $$$1$$$ to $$$n$$$. Their boss promises to give them a bonus if they complete an additional project. The project requires $$$k$$$ units of work in total. The bonus promised to the $$$i$$$-th engineer is $$$a_i$$$ burles. The boss doesn't assign specific tasks ...
1,400
false
true
false
false
false
false
false
false
false
false
38
116A
Linear Kingdom has exactly one tram line. It has _n_ stops, numbered from 1 to _n_ in the order of tram's movement. At the _i_-th stop _a__i_ passengers exit the tram, while _b__i_ passengers enter it. The tram is empty before it arrives at the first stop. Also, when the tram arrives at the last stop, all passengers ex...
800
false
false
true
false
false
false
false
false
false
false
9,423
534E
In Berland a bus travels along the main street of the capital. The street begins from the main square and looks like a very long segment. There are _n_ bus stops located along the street, the _i_-th of them is located at the distance _a__i_ from the central square, all distances are distinct, the stops are numbered in ...
2,400
false
true
true
false
false
true
false
false
false
false
7,697
1111D
There is a colony of villains with several holes aligned in a row, where each hole contains exactly one villain. Each colony arrangement can be expressed as a string of even length, where the $$$i$$$-th character of the string represents the type of villain in the $$$i$$$-th hole. Iron Man can destroy a colony only if ...
2,600
true
false
false
true
false
false
false
false
false
false
5,138
95E
Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. One night Petya was sleeping. He was dreaming of being the president of some island country. The countr...
2,500
false
false
false
true
false
false
false
false
false
true
9,504
1796B
You are given two strings $$$a$$$ and $$$b$$$, consisting of lowercase Latin letters. A template $$$t$$$ is string, consisting of lowercase Latin letters and asterisks (character '*'). A template is called asterisk-minor if the number of asterisks in it is less than or equal to the number of letters in it. A string $$$...
1,000
false
false
true
false
false
false
false
false
false
false
1,501
38E
Problem - 38E - Codeforces =============== xa0 - Codeforces Beta Round 38 (ACM-ICPC Rules)]( --- 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 pro...
1,800
false
false
false
true
false
false
false
false
true
false
9,804
1666H
# Heroes of Might Input file: standard input Output file: standard output Time limit: 3 seconds Memory limit: 512 megabytes Recently, Hellen played her favorite game “Heroes of Might”. She had a hero with only one Rust dragon, which was attacked by another hero with a lot of peasants. Another hero had n groups of pe...
3,500
true
false
false
false
false
false
false
false
false
false
2,278
472F
Problem - 472F - Codeforces =============== xa0 of the following form _x__i_ ^= _x__j_ (in the original task _i_ and _j_ must be different, but in this task we allow _i_ to equal _j_). The goal is to maximize the sum of all _x__i_. Now we just change the goal. You are also given _n_ integers _y_1,u2009_y_...
2,700
true
false
false
false
false
true
false
false
false
false
7,942
1889F
Doremy has a rooted tree of size $$$n$$$ whose root is vertex $$$r$$$. Initially there is a number $$$w_i$$$ written on vertex $$$i$$$. Doremy can use her power to perform this operation at most $$$k$$$ times: 1. Choose a vertex $$$x$$$ ($$$1 leq x leq n$$$). 2. Let $$$s = frac{1}{T}sum_{i in T} w_i$$$ where $$$T$$$ is...
3,500
false
true
false
true
true
false
false
false
false
false
960
126A
Problem - 126A - 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,900
true
false
false
false
false
false
true
true
false
false
9,377
940E
Problem - 940E - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,000
true
true
false
true
true
false
false
false
false
false
5,934
814C
Nadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dianthus-shaped paper pieces was placed on a prominent part of the wall. Brother Koyomi will like it! Still unsatisfied with the garland, Nadeko decided to polish it again. The garland has _n_ pieces numbered from 1 to _n_ from...
1,600
false
false
false
true
false
false
true
false
false
false
6,503
1648E
Berland is a large country with developed airlines. In total, there are $$$n$$$ cities in the country that are historically served by the Berlaflot airline. The airline operates bi-directional flights between $$$m$$$ pairs of cities, $$$i$$$-th of them connects cities with numbers $$$a_i$$$ and $$$b_i$$$ and has a pric...
3,200
false
false
true
false
true
false
false
false
false
true
2,379
1197F
Alice and Bob want to play a game. They have $$$n$$$ colored paper strips; the $$$i$$$-th strip is divided into $$$a_i$$$ cells numbered from $$$1$$$ to $$$a_i$$$. Each cell can have one of $$$3$$$ colors. In the beginning of the game, Alice and Bob put $$$n$$$ chips, the $$$i$$$-th chip is put in the $$$a_i$$$-th cell...
2,700
false
false
false
true
false
false
false
false
false
false
4,710
1004E
Sonya likes ice cream very much. She eats it even during programming competitions. That is why the girl decided that she wants to open her own ice cream shops. Sonya lives in a city with $$$n$$$ junctions and $$$n-1$$$ streets between them. All streets are two-way and connect two junctions. It is possible to travel fro...
2,400
false
true
false
true
true
false
false
true
false
false
5,664
112B
Problem - 112B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,200
true
false
true
false
false
false
false
false
false
false
9,436
111B
Problem - 111B - 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,900
false
false
false
false
true
false
false
true
false
false
9,441
862A
Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is interested in sets, He has a set of _n_ integers. Dr. Evil calls a set of integers evil if the MEX of it is exactly _x_. the MEX ...
1,000
false
true
true
false
false
false
false
false
false
false
6,300
1974B
Polycarp has a string $$$s$$$, which consists of lowercase Latin letters. He encodes this string using the following algorithm: first, he constructs a new auxiliary string $$$r$$$, which consists of all distinct letters of the string $$$s$$$, written in alphabetical order; then the encoding happens as follows: each c...
800
false
false
true
false
false
false
false
false
true
false
448
1759G
A sequence of $$$n$$$ numbers is called permutation if it contains all numbers from $$$1$$$ to $$$n$$$ exactly once. For example, the sequences [$$$3, 1, 4, 2$$$], [$$$1$$$] and [$$$2,1$$$] are permutations, but [$$$1,2,1$$$], [$$$0,1$$$] and [$$$1,3,4$$$]xa0— are not. For a permutation $$$p$$$ of even length $$$n$$$ y...
1,900
true
true
false
false
true
true
false
true
false
false
1,756
2009G3
This is the extreme version of the problem. In this version, the output of each query is different from the easy and hard versions. It is also guaranteed that $$$r geq l+k-1$$$ for all queries. For an arbitrary array $$$b$$$, Yunli can perform the following operation any number of times: Select an index $$$i$$$. Set $...
2,700
false
false
true
true
true
false
false
false
false
false
192
1095D
There are $$$n$$$ kids, numbered from $$$1$$$ to $$$n$$$, dancing in a circle around the Christmas tree. Let's enumerate them in a clockwise direction as $$$p_1$$$, $$$p_2$$$, ..., $$$p_n$$$ (all these numbers are from $$$1$$$ to $$$n$$$ and are distinct, so $$$p$$$ is a permutation). Let the next kid for a kid $$$p_i$...
1,600
false
false
true
false
false
false
false
false
false
false
5,234
1416B
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers, numbered from $$$1$$$ to $$$n$$$. You can perform the following operation no more than $$$3n$$$ times: 1. choose three integers $$$i$$$, $$$j$$$ and $$$x$$$ ($$$1 le i, j le n$$$; $$$0 le x le 10^9$$$); 2. assign $$$a_i := a_i - x cdot i$$$, $$$a_j...
2,000
true
true
false
false
false
true
false
false
false
false
3,601
64A
The package for this problem was not updated by the problem writer or Codeforces administration after we've upgraded the judging servers. To adjust the time limit constraint, a solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then the value 800 ms will ...
1,300
false
false
true
false
false
false
false
false
false
false
9,655
1477E
In the famous Oh-Suit-United tournament, two teams are playing against each other for the grand prize of precious pepper points. The first team consists of $$$n$$$ players, and the second team consists of $$$m$$$ players. Each player has a potential: the potential of the $$$i$$$-th player in the first team is $$$a_i$$$...
3,300
false
true
false
false
true
false
false
false
false
false
3,286
1715C
Stanley has decided to buy a new desktop PC made by the company "Monoblock", and to solve captcha on their website, he needs to solve the following task. The awesomeness of an array is the minimum number of blocks of consecutive identical numbers in which the array could be split. For example, the awesomeness of an arr...
1,700
true
false
true
false
true
false
false
false
false
false
1,991
467D
After you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the English teacher told him to prepare an essay. Fedor didn't want to prepare the essay, so he asked Alex for help. Alex came to help and wrote the essay for Fedor. But Fedor didn't like the essay at all...
2,400
false
false
false
true
false
false
false
false
false
true
7,969
1733D1
This is the easy version of the problem. In this version, $$$n le 3000$$$, $$$x ge y$$$ holds. You can make hacks only if both versions of the problem are solved. You are given two binary strings $$$a$$$ and $$$b$$$, both of length $$$n$$$. You can do the following operation any number of times (possibly zero). Select...
1,400
true
true
false
false
false
true
false
false
false
false
1,889
1280D
The Oak has $$$n$$$ nesting places, numbered with integers from $$$1$$$ to $$$n$$$. Nesting place $$$i$$$ is home to $$$b_i$$$ bees and $$$w_i$$$ wasps. Some nesting places are connected by branches. We call two nesting places adjacent if there exists a branch between them. A simple path from nesting place $$$x$$$ to $...
2,500
false
true
false
true
false
false
false
false
false
false
4,291
1399C
There are $$$n$$$ people who want to participate in a boat competition. The weight of the $$$i$$$-th participant is $$$w_i$$$. Only teams consisting of two people can participate in this competition. As an organizer, you think that it's fair to allow only teams with the same total weight. So, if there are $$$k$$$ teams...
1,200
false
true
false
false
false
false
true
false
false
false
3,677
1350B
There are $$$n$$$ models in the shop numbered from $$$1$$$ to $$$n$$$, with sizes $$$s_1, s_2, ldots, s_n$$$. Orac will buy some of the models and will arrange them in the order of increasing numbers (i.e. indices, but not sizes). Orac thinks that the obtained arrangement is beatiful, if for any two adjacent models wit...
1,400
true
false
false
true
false
false
false
false
false
false
3,956
1661E
You are given a matrix $$$a$$$, consisting of $$$3$$$ rows and $$$n$$$ columns. Each cell of the matrix is either free or taken. A free cell $$$y$$$ is reachable from a free cell $$$x$$$ if at least one of these conditions hold: $$$x$$$ and $$$y$$$ share a side; there exists a free cell $$$z$$$ such that $$$z$$$ is r...
2,500
true
false
false
true
true
false
true
false
false
false
2,315
79C
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string _s_, and she tried to remember the string _s_ correctly. However, Ciel ...
1,800
false
true
false
true
true
false
false
false
false
false
9,568
46D
Nowadays it is becoming increasingly difficult to park a car in cities successfully. Let's imagine a segment of a street as long as _L_ meters along which a parking lot is located. Drivers should park their cars strictly parallel to the pavement on the right side of the street (remember that in the country the authors ...
1,800
false
false
true
false
true
false
false
false
false
false
9,746
1682D
There are $$$n$$$ nodes arranged in a circle numbered from $$$1$$$ to $$$n$$$ in the clockwise order. You are also given a binary string $$$s$$$ of length $$$n$$$. Your task is to construct a tree on the given $$$n$$$ nodes satisfying the two conditions below or report that there such tree does not exist: For each nod...
2,000
false
false
true
false
false
true
false
false
false
false
2,176
98E
Shrek and the Donkey (as you can guess, they also live in the far away kingdom) decided to play a card game called YAGame. The rules are very simple: initially Shrek holds _m_ cards and the Donkey holds _n_ cards (the players do not see each other's cards), and one more card lies on the table face down so that both pla...
2,700
true
false
false
true
false
false
false
false
false
false
9,492
962A
Polycarp has created his own training plan to prepare for the programming contests. He will train for $$$n$$$ days, all days are numbered from $$$1$$$ to $$$n$$$, beginning from the first. On the $$$i$$$-th day Polycarp will necessarily solve $$$a_i$$$ problems. One evening Polycarp plans to celebrate the equator. He w...
1,300
false
false
true
false
false
false
false
false
false
false
5,856
1285C
Problem - 1285C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,400
true
false
false
false
false
false
true
false
false
false
4,265
1893A
You are given an array $$$b_1, b_2, ldots, b_n$$$. An anonymous informant has told you that the array $$$b$$$ was obtained as follows: initially, there existed an array $$$a_1, a_2, ldots, a_n$$$, after which the following two-component operation was performed $$$k$$$ times: 1. A fixed point$$$^{dagger}$$$ $$$x$$$ of t...
1,400
false
false
true
false
false
false
true
false
false
true
951
1029A
Problem - 1029A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,300
false
false
true
false
false
false
false
false
false
false
5,561
883J
The mayor of the Berland city S sees the beauty differently than other city-dwellers. In particular, he does not understand at all, how antique houses can be nice-looking. So the mayor wants to demolish all ancient buildings in the city. The city S is going to host the football championship very soon. In order to make ...
2,400
false
true
false
false
false
true
false
false
true
false
6,218
1427H
A prisoner wants to escape from a prison. The prison is represented by the interior of the convex polygon with vertices $$$P_1, P_2, P_3, ldots, P_{n+1}, P_{n+2}, P_{n+3}$$$. It holds $$$P_1=(0,0)$$$, $$$P_{n+1}=(0, h)$$$, $$$P_{n+2}=(-10^{18}, h)$$$ and $$$P_{n+3}=(-10^{18}, 0)$$$. The prison walls $$$P_{n+1}P_{n+2}$$...
3,500
false
false
false
false
false
false
false
true
false
false
3,526
612A
Problem - 612A - Codeforces =============== xa0 ]( "Educational Codeforces Round 4") . Input The first line contains three positive integers _n_,u2009_p_,u2009_q_ (1u2009≤u2009_p_,u2009_q_u2009≤u2009_n_u2009≤u2009100). The second line contains the string _s_ consists of lowercase and uppercase latin letter...
1,300
false
false
true
false
false
false
true
false
false
false
7,393
1236D
Alice got a new doll these days. It can even walk! Alice has built a maze for the doll and wants to test it. The maze is a grid with $$$n$$$ rows and $$$m$$$ columns. There are $$$k$$$ obstacles, the $$$i$$$-th of them is on the cell $$$(x_i, y_i)$$$, which means the cell in the intersection of the $$$x_i$$$-th row and...
2,300
false
true
true
false
true
false
true
false
false
false
4,515
1307A
The USA Construction Operation (USACO) recently ordered Farmer John to arrange a row of $$$n$$$ haybale piles on the farm. The $$$i$$$-th pile contains $$$a_i$$$ haybales. However, Farmer John has just left for vacation, leaving Bessie all on her own. Every day, Bessie the naughty cow can choose to move one haybale in ...
800
false
true
true
false
false
false
false
false
false
false
4,156
238D
There is a programming language in which every program is a non-empty sequence of "<" and ">" signs and digits. Let's explain how the interpreter of this programming language works. A program is interpreted using movement of instruction pointer (IP) which consists of two parts. Current character pointer (CP); Directi...
2,900
false
false
true
false
true
false
false
false
false
false
8,881
1283E
Oh, New Year. The time to gather all your friends and reflect on the heartwarming events of the past year... $$$n$$$ friends live in a city which can be represented as a number line. The $$$i$$$-th friend lives in a house with an integer coordinate $$$x_i$$$. The $$$i$$$-th friend can come celebrate the New Year to the...
1,800
false
true
false
true
false
false
false
false
false
false
4,276
122B
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. One day Petya was delivered a string _s_, containing only digits. He needs to find a string that rep...
1,000
false
false
true
false
false
false
true
false
false
false
9,390
1746B
You have an array $$$a$$$ of size $$$n$$$ consisting only of zeroes and ones. You can do the following operation: choose two indices $$$1 le i , j le n$$$, $$$i e j$$$, add $$$a_{i}$$$ to $$$a_{j}$$$, remove $$$a_{i}$$$ from $$$a$$$. Note that elements of $$$a$$$ can become bigger than $$$1$$$ after performing some...
800
false
true
false
false
false
true
false
false
false
false
1,809
1842F
Problem - 1842F - 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,500
false
true
false
false
false
false
false
false
true
false
1,234
1632E1
This version of the problem differs from the next one only in the constraint on $$$n$$$. A tree is a connected undirected graph without cycles. A weighted tree has a weight assigned to each edge. The distance between two vertices is the minimum sum of weights on the path connecting them. You are given a weighted tree w...
2,400
false
false
false
false
true
false
false
true
false
true
2,454
468A
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game. Initially you have a sequence of _n_ integers: 1,u20092,u2009...,u2009_n_. In a single step, you can pick two of them, let's denote them _a_ and _b_, erase them from the sequence, and append to the sequ...
1,500
true
true
false
false
false
true
false
false
false
false
7,967
319B
Problem - 319B - 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,900
false
false
true
false
true
false
false
false
false
false
8,557
954F
You are running through a rectangular field. This field can be represented as a matrix with 3 rows and _m_ columns. (_i_,u2009_j_) denotes a cell belonging to _i_-th row and _j_-th column. You start in (2,u20091) and have to end your path in (2,u2009_m_). From the cell (_i_,u2009_j_) you may advance to: (_i_u2009-u200...
2,100
false
false
false
true
false
false
false
false
true
false
5,904
331C2
Yet another Armageddon is coming! This time the culprit is the Julya tribe calendar. The beavers in this tribe knew math very well. Smart Beaver, an archaeologist, got a sacred plate with a magic integer on it. The translation from Old Beaverish is as follows: "May the Great Beaver bless you! May your chacres open and ...
2,400
false
false
false
true
false
false
false
false
false
false
8,517
725D
One tradition of ACM-ICPC contests is that a team gets a balloon for every solved problem. We assume that the submission time doesn't matter and teams are sorted only by the number of balloons they have. It means that one's place is equal to the number of teams with more balloons, increased by 1. For example, if there ...
1,800
false
true
false
false
true
false
false
false
false
false
6,904
1323B
You are given an array $$$a$$$ of length $$$n$$$ and array $$$b$$$ of length $$$m$$$ both consisting of only integers $$$0$$$ and $$$1$$$. Consider a matrix $$$c$$$ of size $$$n imes m$$$ formed by following rule: $$$c_{i, j} = a_i cdot b_j$$$ (i.e. $$$a_i$$$ multiplied by $$$b_j$$$). It's easy to see that $$$c$$$ con...
1,500
false
true
true
false
false
false
false
true
false
false
4,100
649B
Statement is not available on English language Есть _n_-подъездный дом, в каждом подъезде по _m_ этажей, и на каждом этаже каждого подъезда ровно _k_ квартир. Таким образом, в доме всего _n_·_m_·_k_ квартир. Они пронумерованы естественным образом от 1 до _n_·_m_·_k_, то есть первая квартира на первом этаже в первом под...
1,400
false
false
false
false
false
true
false
false
false
false
7,221
1494C
You are playing a game similar to Sokoban on an infinite number line. The game is discrete, so you only consider integer positions on the line. You start on a position $$$0$$$. There are $$$n$$$ boxes, the $$$i$$$-th box is on a position $$$a_i$$$. All positions of the boxes are distinct. There are also $$$m$$$ special...
1,900
false
true
true
true
false
false
false
true
false
false
3,200
802K
Thank you for helping Heidi! It is now the second of April, but she has been summoned by Jenny again. The pranks do not seem to end... In the meantime, Heidi has decided that she does not trust her friends anymore. Not too much, anyway. Her relative lack of trust is manifested as follows: whereas previously she would n...
2,100
false
false
false
true
false
false
false
false
false
false
6,557
1772A
Problem - 1772A - 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,663
1734B
There is a pyramid which consists of $$$n$$$ floors. The floors are numbered from top to bottom in increasing order. In the pyramid, the $$$i$$$-th floor consists of $$$i$$$ rooms. Denote the $$$j$$$-th room on the $$$i$$$-th floor as $$$(i,j)$$$. For all positive integers $$$i$$$ and $$$j$$$ such that $$$1 le j le i <...
800
false
false
false
false
false
true
false
false
false
false
1,885
1343B
You are given a positive integer $$$n$$$, it is guaranteed that $$$n$$$ is even (i.e. divisible by $$$2$$$). You want to construct the array $$$a$$$ of length $$$n$$$ such that: The first $$$frac{n}{2}$$$ elements of $$$a$$$ are even (divisible by $$$2$$$); the second $$$frac{n}{2}$$$ elements of $$$a$$$ are odd (not...
800
true
false
false
false
false
true
false
false
false
false
3,992
1351A
Problem - 1351A - 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
3,955
1446F
You are given an integer $$$k$$$ and $$$n$$$ distinct points with integer coordinates on the Euclidean plane, the $$$i$$$-th point has coordinates $$$(x_i, y_i)$$$. Consider a list of all the $$$frac{n(n - 1)}{2}$$$ pairs of points $$$((x_i, y_i), (x_j, y_j))$$$ ($$$1 le i < j le n$$$). For every such pair, write out t...
3,200
false
false
false
false
true
false
false
true
false
false
3,441
1886C
Recall that string $$$a$$$ is lexicographically smaller than string $$$b$$$ if $$$a$$$ is a prefix of $$$b$$$ (and $$$a e b$$$), or there exists an index $$$i$$$ ($$$1 le i le min(a, b)$$$) such that $$$a_i < b_i$$$, and for any index $$$j$$$ ($$$1 le j < i$$$) $$$a_j = b_j$$$. Consider a sequence of strings $$$s_1, s...
1,600
false
false
true
false
false
false
false
false
false
false
975
64I
Problem - 64I - Codeforces =============== xa0 or DESC (nonascending order). Rules in the list are separated by a single comma with a single space. You have to sort rows of the table primarily by the first rule, then, in case of a tie sort by the second rule. And so on. If two rows are equal in terms of every...
2,400
false
false
false
false
false
false
false
false
true
false
9,647
449D
Problem - 449D - 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,400
false
false
false
true
false
false
false
false
false
false
8,041
128D
Problem - 128D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,000
false
false
true
false
false
true
false
false
false
false
9,367
1149E
In Byteland, there are two political parties fighting for seats in the Parliament in the upcoming elections: Wrong Answer Party and Time Limit Exceeded Party. As they want to convince as many citizens as possible to cast their votes on them, they keep promising lower and lower taxes. There are $$$n$$$ cities in Bytelan...
3,200
false
false
false
false
false
false
false
false
false
true
4,965
1680E
You are given a board of size $$$2 imes n$$$ ($$$2$$$ rows, $$$n$$$ columns). Some cells of the board contain chips. The chip is represented as '*', and an empty space is represented as '.'. It is guaranteed that there is at least one chip on the board. In one move, you can choose any chip and move it to any adjacent ...
2,000
false
true
false
true
false
false
false
false
false
false
2,187
1771F
Hossam gives you a sequence of integers $$$a_1, , a_2, , dots, , a_n$$$ of length $$$n$$$. Moreover, he will give you $$$q$$$ queries of type $$$(l, , r)$$$. For each query, consider the elements $$$a_l, , a_{l + 1}, , dots, , a_r$$$. Hossam wants to know the smallest number in this sequence, such that it occurs in thi...
2,500
false
false
false
false
true
false
false
true
false
false
1,664
17C
Nick likes strings very much, he likes to rotate them, sort them, rearrange characters within a string... Once he wrote a random string of characters a, b, c on a piece of paper and began to perform the following operations: to take two adjacent characters and replace the second character with the first one, to take ...
2,500
false
false
false
true
false
false
false
false
false
false
9,908
1437B
You are given a string $$$s$$$ of even length $$$n$$$. String $$$s$$$ is binary, in other words, consists only of 0's and 1's. String $$$s$$$ has exactly $$$frac{n}{2}$$$ zeroes and $$$frac{n}{2}$$$ ones ($$$n$$$ is even). In one operation you can reverse any substring of $$$s$$$. A substring of a string is a contiguou...
1,200
false
true
false
false
false
true
false
false
false
false
3,484
818F
Ivan is developing his own computer game. Now he tries to create some levels for his game. But firstly for each level he needs to draw a graph representing the structure of the level. Ivan decided that there should be exactly _n__i_ vertices in the graph representing level _i_, and the edges have to be bidirectional. W...
2,100
true
false
false
false
false
false
false
true
false
false
6,482
1364A
Ehab loves number theory, but for some reason he hates the number $$$x$$$. Given an array $$$a$$$, find the length of its longest subarray such that the sum of its elements isn't divisible by $$$x$$$, or determine that such subarray doesn't exist. An array $$$a$$$ is a subarray of an array $$$b$$$ if $$$a$$$ can be obt...
1,200
false
false
false
false
true
false
true
false
false
false
3,862
1043G
Ildar took a band (a thin strip of cloth) and colored it. Formally, the band has $$$n$$$ cells, each of them is colored into one of $$$26$$$ colors, so we can denote each color with one of the lowercase letters of English alphabet. Ildar decided to take some segment of the band $$$[l, r]$$$ ($$$1 le l le r le n$$$) he ...
3,500
false
false
false
false
true
false
false
false
false
false
5,477
1295C
You are given two strings $$$s$$$ and $$$t$$$ consisting of lowercase Latin letters. Also you have a string $$$z$$$ which is initially empty. You want string $$$z$$$ to be equal to string $$$t$$$. You can perform the following operation to achieve this: append any subsequence of $$$s$$$ at the end of string $$$z$$$. A ...
1,600
false
true
false
true
false
false
false
false
false
false
4,221
792B
_n_ children are standing in a circle and playing the counting-out game. Children are numbered clockwise from 1 to _n_. In the beginning, the first child is considered the leader. The game is played in _k_ steps. In the _i_-th step the leader counts out _a__i_ people in clockwise order, starting from the next person. T...
1,300
false
false
true
false
false
false
false
false
false
false
6,612
996B
Allen wants to enter a fan zone that occupies a round square and has $$$n$$$ entrances. There already is a queue of $$$a_i$$$ people in front of the $$$i$$$-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute. Allen uses the following strategy to enter the fan zone: Initiall...
1,300
true
false
false
false
false
false
false
true
false
false
5,719
1848F
Recently, Vika was studying her favorite internet resource - Wikipedia. On the expanses of Wikipedia, she read about an interesting mathematical operation bmod n}$$$. Here $$$x bmod y$$$ denotes the remainder of dividing $$$x$$$ by $$$y$$$. The elements of the array are numbered starting from $$$0$$$. Since it is not e...
2,400
true
false
false
true
false
false
false
true
false
false
1,189
1566B
A binary string is a string that consists of characters $$$0$$$ and $$$1$$$. Let $$$operatorname{MEX}$$$ of a binary string be the smallest digit among $$$0$$$, $$$1$$$, or $$$2$$$ that does not occur in the string. For example, $$$operatorname{MEX}$$$ of $$$001011$$$ is $$$2$$$, because $$$0$$$ and $$$1$$$ occur in th...
800
false
true
false
true
false
true
false
false
false
false
2,812
339D
Xenia the beginner programmer has a sequence _a_, consisting of 2_n_ non-negative integers: _a_1,u2009_a_2,u2009...,u2009_a_2_n_. Xenia is currently studying bit operations. To better understand how they work, Xenia decided to calculate some value _v_ for _a_. Namely, it takes several iterations to calculate value _v_....
1,700
false
false
false
false
true
false
false
false
false
false
8,477
847H
Polycarp plans to conduct a load testing of its new project Fakebook. He already agreed with his friends that at certain points in time they will send requests to Fakebook. The load testing will last _n_ minutes and in the _i_-th minute friends will send _a__i_ requests. Polycarp plans to test Fakebook under a special ...
1,600
false
true
false
false
false
false
false
false
false
false
6,364
1179B
This morning Tolik has understood that while he was sleeping he had invented an incredible problem which will be a perfect fit for Codeforces! But, as a "Discuss tasks" project hasn't been born yet (in English, well), he decides to test a problem and asks his uncle. After a long time thinking, Tolik's uncle hasn't any ...
1,800
false
false
false
false
false
true
false
false
false
false
4,820
732D
Vasiliy has an exam period which will continue for _n_ days. He has to pass exams on _m_ subjects. Subjects are numbered from 1 to _m_. About every day we know exam for which one of _m_ subjects can be passed on that day. Perhaps, some day you can't pass any exam. It is not allowed to pass more than one exam on any day...
1,700
false
true
false
false
false
false
false
true
true
false
6,867
1633E
You are given a connected weighted undirected graph, consisting of $$$n$$$ vertices and $$$m$$$ edges. You are asked $$$k$$$ queries about it. Each query consists of a single integer $$$x$$$. For each query, you select a spanning tree in the graph. Let the weights of its edges be $$$w_1, w_2, dots, w_{n-1}$$$. The cost...
2,400
true
true
false
false
true
false
false
true
true
true
2,448
877E
Danil decided to earn some money, so he had found a part-time job. The interview have went well, so now he is a light switcher. Danil works in a rooted tree (undirected connected acyclic graph) with _n_ vertices, vertex 1 is the root of the tree. There is a room in each vertex, light can be switched on or off in each r...
2,000
false
false
false
false
true
false
false
false
false
false
6,236
1999C
As a computer science student, Alex faces a hard challengexa0— showering. He tries to shower daily, but despite his best efforts there are always challenges. He takes $$$s$$$ minutes to shower and a day only has $$$m$$$ minutes! He already has $$$n$$$ tasks planned for the day. Task $$$i$$$ is represented as an interva...
800
false
true
true
false
false
false
false
false
false
false
269
659A
Vasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to _n_. Entrance _n_ and entrance 1 are adjacent. Today Vasya got bored and decided to take a walk in the yard. Vasya lives in entrance _a_ and he decided that during his walk he will move around the house _b_ entrances in the...
1,000
true
false
true
false
false
false
false
false
false
false
7,189