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
377D
Pavel is going to make a game of his dream. However, he knows that he can't make it on his own so he founded a development company and hired _n_ workers of staff. Now he wants to pick _n_ workers from the staff who will be directly responsible for developing a game. Each worker has a certain skill level _v__i_. Besides...
2,400
false
false
false
false
true
false
false
false
false
false
8,321
1621C
This is an interactive problem. The jury has a permutation $$$p$$$ of length $$$n$$$ and wants you to guess it. For this, the jury created another permutation $$$q$$$ of length $$$n$$$. Initially, $$$q$$$ is an identity permutation ($$$q_i = i$$$ for all $$$i$$$). You can ask queries to get $$$q_i$$$ for any $$$i$$$ yo...
1,700
true
false
false
false
false
false
false
false
false
false
2,518
703C
And while Mishka is enjoying her trip... Chris is a little brown bear. No one knows, where and when he met Mishka, but for a long time they are together (excluding her current trip). However, best friends are important too. John is Chris' best friend. Once walking with his friend, John gave Chris the following problem:...
2,100
false
false
true
false
false
false
false
false
false
false
7,009
1736C1
This is the easy version of this problem. In this version, we do not have queries. Note that we have multiple test cases in this version. You can make hacks only if both versions of the problem are solved. An array $$$b$$$ of length $$$m$$$ is good if for all $$$i$$$ the $$$i$$$-th element is greater than or equal to $...
1,300
false
false
false
false
true
false
false
true
false
false
1,872
111A
Problem - 111A - 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
true
false
false
false
false
false
false
false
false
9,442
1080D
Recently, Olya received a magical square with the size of $$$2^n imes 2^n$$$. It seems to her sister that one square is boring. Therefore, she asked Olya to perform exactly $$$k$$$ splitting operations. A Splitting operation is an operation during which Olya takes a square with side $$$a$$$ and cuts it into 4 equal squ...
2,000
true
false
true
false
false
true
false
false
false
false
5,326
1951H
There is an array $$$a$$$ of size $$$2^k$$$ for some positive integer $$$k$$$, which is initially a permutation of values from $$$1$$$ to $$$2^k$$$. Alice and Bob play the following game on the array $$$a$$$. First, a value $$$t$$$ between $$$1$$$ and $$$k$$$ is shown to both Alice and Bob. Then, for exactly $$$t$$$ tu...
3,200
false
true
false
true
false
false
false
true
false
false
567
513G3
You are given a permutation of _n_ numbers _p_1,u2009_p_2,u2009...,u2009_p__n_. We perform _k_ operations of the following type: choose uniformly at random two indices _l_ and _r_ (_l_u2009≤u2009_r_) and reverse the order of the elements _p__l_,u2009_p__l_u2009+u20091,u2009...,u2009_p__r_. Your task is to find the expe...
3,100
false
false
false
true
false
false
false
false
false
false
7,781
407E
Problem - 407E - 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
false
false
false
false
true
false
false
false
false
false
8,194
960B
You are given two arrays _A_ and _B_, each of size _n_. The error, _E_, between these two arrays is defined . You have to perform exactly _k_1 operations on array _A_ and exactly _k_2 operations on array _B_. In one operation, you have to choose one element of the array and increase or decrease it by 1. Output the mini...
1,500
false
true
false
false
true
false
false
false
true
false
5,870
242A
Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin _x_ times, then Petya tosses a coin _y_ times. If the tossing player gets head, he scores one point. If he gets tail, nobody gets any points. The winner is the player with most points by t...
1,100
false
false
true
false
false
false
true
false
false
false
8,868
228B
You've got two rectangular tables with sizes _n__a_u2009×u2009_m__a_ and _n__b_u2009×u2009_m__b_ cells. The tables consist of zeroes and ones. We will consider the rows and columns of both tables indexed starting from 1. Then we will define the element of the first table, located at the intersection of the _i_-th row a...
1,400
false
false
true
false
false
false
true
false
false
false
8,927
1917B
You are given a string $$$s$$$ of length $$$n$$$. Let's define two operations you can apply on the string: remove the first character of the string; remove the second character of the string. Your task is to find the number of distinct non-empty strings that can be generated by applying the given operations on the in...
1,100
false
false
false
true
true
false
true
false
false
false
793
1409C
We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array: The array consists of $$$n$$$ distinct positive (greater than $$$0$$$) integers. The array contains two elements $$$x$$$ and $$$y$$$ (these elements are known for you) such that $$$x < y$$$. I...
1,200
true
false
false
false
false
false
true
false
false
false
3,625
1626A
You are given a string $$$s$$$, consisting of lowercase Latin letters. Every letter appears in it no more than twice. Your task is to rearrange the letters in the string in such a way that for each pair of letters that appear exactly twice, the distance between the letters in the pair is the same. You are not allowed t...
800
false
false
false
false
false
true
false
false
true
false
2,487
331E1
Everybody knows that we have been living in the Matrix for a long time. And in the new seventh Matrix the world is ruled by beavers. So let's take beaver Neo. Neo has so-called "deja vu" outbursts when he gets visions of events in some places he's been at or is going to be at. Let's examine the phenomenon in more detai...
2,900
false
false
true
false
false
true
false
false
false
true
8,512
571D
Oscolcovo city has a campus consisting of _n_ student dormitories, _n_ universities and _n_ military offices. Initially, the _i_-th dormitory belongs to the _i_-th university and is assigned to the _i_-th military office. Life goes on and the campus is continuously going through some changes. The changes can be of four...
3,100
false
false
false
false
true
false
false
true
false
false
7,563
1582C
Grandma Capa has decided to knit a scarf and asked Grandpa Sher to make a pattern for it, a pattern is a string consisting of lowercase English letters. Grandpa Sher wrote a string $$$s$$$ of length $$$n$$$. Grandma Capa wants to knit a beautiful scarf, and in her opinion, a beautiful scarf can only be knit from a stri...
1,200
false
true
false
false
true
false
true
false
false
false
2,723
735E
Ostap already settled down in Rio de Janiero suburb and started to grow a tree in his garden. Recall that a tree is a connected undirected acyclic graph. Ostap's tree now has _n_ vertices. He wants to paint some vertices of the tree black such that from any vertex _u_ there is at least one black vertex _v_ at distance ...
2,500
false
false
false
true
false
false
false
false
false
false
6,848
233A
Problem - 233A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
800
true
false
true
false
false
false
false
false
false
false
8,906
933C
Problem - 933C - 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,700
false
false
false
false
false
false
false
false
false
true
5,969
329D
Important: All possible tests are in the pretest, so you shouldn't hack on this problem. So, if you passed pretests, you will also pass the system test. You are an adventurer currently journeying inside an evil temple. After defeating a couple of weak monsters, you arrived at a square room consisting of tiles forming a...
2,500
false
false
false
false
false
true
false
false
false
false
8,526
690B3
Zombies have found out about the Zombie Contamination level checker and managed to damage it! Now detecting the shape of their main compound will be a real challenge for Heidi. As before, a lair can be represented as a strictly convex polygon on a lattice. Each vertex of the polygon occupies a point on the lattice. How...
2,600
false
false
false
false
true
false
false
false
false
false
7,059
1089F
Problem - 1089F - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,900
true
false
false
false
false
false
false
false
false
false
5,280
101D
Gerald is positioned in an old castle which consists of _n_ halls connected with _n_u2009-u20091 corridors. It is exactly one way to go from any hall to any other one. Thus, the graph is a tree. Initially, at the moment of time 0, Gerald is positioned in hall 1. Besides, some other hall of the castle contains the treas...
2,300
false
true
false
true
false
false
false
false
true
false
9,476
1824C
LuoTianyi gives you a tree with values in its vertices, and the root of the tree is vertex $$$1$$$. In one operation, you can change the value in one vertex to any non-negative integer. Now you need to find the minimum number of operations you need to perform to make each path from the root to leaf$$$^{dagger}$$$ has a...
2,500
false
true
false
true
true
false
false
false
false
false
1,334
1676E
Timur has $$$n$$$ candies. The $$$i$$$-th candy has a quantity of sugar equal to $$$a_i$$$. So, by eating the $$$i$$$-th candy, Timur consumes a quantity of sugar equal to $$$a_i$$$. Timur will ask you $$$q$$$ queries regarding his candies. For the $$$j$$$-th query you have to answer what is the minimum number of candi...
1,100
false
true
false
false
false
false
false
true
true
false
2,211
626E
Problem - 626E - Codeforces =============== xa0 ]( "23515") integers. Find the non-empty subset (with repetition) with the maximum simple skewness. The mean of a collection is the average of its elements. The median of a collection is its middle element when all of its elements are sorted, or the average o...
2,400
true
false
false
false
false
false
false
true
false
false
7,324
336E
Vasily the bear has two favorite integers _n_ and _k_ and a pencil. Besides, he's got _k_ jars with different water color paints. All jars are numbered in some manner from 1 to _k_, inclusive. The jar number _i_ contains the paint of the _i_-th color. Initially the bear took a pencil and drew four segments on the coord...
2,700
false
false
true
true
false
false
false
false
false
false
8,488
189A
Problem - 189A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,300
false
false
false
true
false
false
true
false
false
false
9,084
912C
A lot of students spend their winter holidays productively. Vlad has advanced very well in doing so! For three days already, fueled by salads and tangerinesxa0— the leftovers from New Year celebrationxa0— he has been calibrating his rating in his favorite MOBA game, playing as a hero named Perun. Perun has an ultimate ...
2,500
false
true
false
false
false
false
true
false
true
false
6,094
424E
Cold winter evenings in Tomsk are very boring — nobody wants be on the streets at such a time. Residents of Tomsk while away the time sitting in warm apartments, inventing a lot of different games. One of such games is 'Colored Jenga'. This game requires wooden blocks of three colors: red, green and blue. A tower of _n...
2,500
false
false
false
true
false
false
false
false
false
false
8,139
1185D
A sequence $$$a_1, a_2, dots, a_k$$$ is called an arithmetic progression if for each $$$i$$$ from $$$1$$$ to $$$k$$$ elements satisfy the condition $$$a_i = a_1 + c cdot (i - 1)$$$ for some fixed $$$c$$$. For example, these five sequences are arithmetic progressions: $$$[5, 7, 9, 11]$$$, $$$[101]$$$, $$$[101, 100, 99]$...
1,700
true
false
true
false
false
false
false
false
false
false
4,776
1393D
Carousel Boutique is busy again! Rarity has decided to visit the pony ball and she surely needs a new dress, because going out in the same dress several times is a sign of bad manners. First of all, she needs a dress pattern, which she is going to cut out from the rectangular piece of the multicolored fabric. The piece...
2,100
false
false
true
true
false
false
false
false
false
false
3,704
103A
The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of _n_ questions; the questions are to be answered strictly in the order in which they are given, from question 1 to...
1,100
true
true
true
false
false
false
false
false
false
false
9,472
1327B
The King of Berland Polycarp LXXXIV has $$$n$$$ daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence there are $$$n$$$ other kingdoms as well. So Polycarp LXXXIV has enumerated his daughters from $$$1$$$ to $$$n$$$ and th...
1,200
false
true
false
false
false
false
true
false
false
true
4,077
898F
A correct expression of the form a+b=c was written; _a_, _b_ and _c_ are non-negative integers without leading zeros. In this expression, the plus and equally signs were lost. The task is to restore the expression. In other words, one character '+' and one character '=' should be inserted into given sequence of digits ...
2,300
true
false
false
false
false
false
true
false
false
false
6,153
509F
Programming teacher Dmitry Olegovich is going to propose the following task for one of his tests for students: You are given a tree _T_ with _n_ vertices, specified by its adjacency matrix _a_[1... _n_,u20091... _n_]. What is the output of the following pseudocode? used[1 ... n] = {0, ..., 0};procedure dfs(v): prin...
2,300
false
false
false
true
false
false
false
false
false
false
7,801
717F
I’m strolling on sunshine, yeah-ah! And doesn’t it feel good! Well, it certainly feels good for our Heroes of Making Magic, who are casually walking on a one-directional road, fighting imps. Imps are weak and feeble creatures and they are not good at much. However, Heroes enjoy fighting them. For fun, if nothing else. ...
2,600
false
false
false
false
true
false
false
false
false
false
6,947
1166C
The legend of the foundation of Vectorland talks of two integers $$$x$$$ and $$$y$$$. Centuries ago, the array king placed two markers at points $$$x$$$ and $$$y$$$ on the number line and conquered all the land in between (including the endpoints), which he declared to be Arrayland. Many years later, the vector king pl...
1,500
false
false
false
false
false
false
false
true
true
false
4,887
1764F
Doremy has an edge-weighted tree with $$$n$$$ vertices whose weights are integers between $$$1$$$ and $$$10^9$$$. She does $$$frac{n(n+1)}{2}$$$ experiments on it. In each experiment, Doremy chooses vertices $$$i$$$ and $$$j$$$ such that $$$j leq i$$$ and connects them directly with an edge with weight $$$1$$$. Then, t...
2,500
false
false
false
false
false
true
true
false
true
false
1,722
120A
A sky scraper with 1000 floors has been built in the city of N. It has modern superfast elevators to help to travel from one floor to another. Each elevator has two doors, the front one and the back one. If one goes in through the front door, he goes out through the back one and vice versa. The elevator has two rails n...
1,000
true
false
true
false
false
false
true
false
false
false
9,406
1025B
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers $$$(a_1, b_1)$$$, $$$(a_2, b_2)$$$, ..., $$$(a_n, b_n)$$$ t...
1,600
false
true
false
false
false
false
true
false
false
false
5,582
938D
Musicians of a popular band "Flayer" have announced that they are going to "make their exit" with a world tour. Of course, they will visit Berland as well. There are _n_ cities in Berland. People can travel between cities using two-directional train routes; there are exactly _m_ routes, _i_-th route can be used to go f...
2,000
false
false
false
false
true
false
false
false
false
true
5,948
282C
The Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string. A Bitlandish string is a string made only of characters "0" and "1". BitHaval (the mayor of Bitland) loves to play with Bitlandish strings. He takes some Bitlandish st...
1,500
true
false
true
false
false
true
false
false
false
false
8,706
1851C
Vlad remembered that he had a series of $$$n$$$ tiles and a number $$$k$$$. The tiles were numbered from left to right, and the $$$i$$$-th tile had colour $$$c_i$$$. If you stand on the first tile and start jumping any number of tiles right, you can get a path of length $$$p$$$. The length of the path is the number of ...
1,000
false
true
false
false
false
false
false
false
false
false
1,172
370B
Lately, a national version of a bingo game has become very popular in Berland. There are _n_ players playing the game, each player has a card with numbers. The numbers on each card are distinct, but distinct cards can have equal numbers. The card of the _i_-th player contains _m__i_ numbers. During the game the host ta...
1,300
false
false
true
false
false
false
false
false
false
false
8,352
106C
Lavrenty, a baker, is going to make several buns with stuffings and sell them. Lavrenty has _n_ grams of dough as well as _m_ different stuffing types. The stuffing types are numerated from 1 to _m_. Lavrenty knows that he has _a__i_ grams left of the _i_-th stuffing. It takes exactly _b__i_ grams of stuffing _i_ and _...
1,700
false
false
false
true
false
false
false
false
false
false
9,459
1608B
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that: There are exactly $$$a$$$ integers $$$i$$$ with $$$2 le i le n-1$$$ such that $$$p_{i-1} < p_i > p_{i+1}$$$ (in other words, there are exactly $$$a$$$ local max...
1,200
false
true
false
false
false
true
false
false
false
false
2,614
847K
In the evening Polycarp decided to analyze his today's travel expenses on public transport. The bus system in the capital of Berland is arranged in such a way that each bus runs along the route between two stops. Each bus has no intermediate stops. So each of the buses continuously runs along the route from one stop to...
1,800
false
true
true
false
false
false
false
false
true
false
6,361
1733B
There is a badminton championship in which $$$n$$$ players take part. The players are numbered from $$$1$$$ to $$$n$$$. The championship proceeds as follows: player $$$1$$$ and player $$$2$$$ play a game, then the winner and player $$$3$$$ play a game, and then the winner and player $$$4$$$ play a game, and so on. So, ...
900
true
false
false
false
false
true
false
false
false
false
1,891
490C
Polycarpus participates in a competition for hacking into a new secure messenger. He's almost won. Having carefully studied the interaction protocol, Polycarpus came to the conclusion that the secret key can be obtained if he properly cuts the public key of the application into two parts. The public key is a long integ...
1,700
true
false
false
false
false
false
true
false
false
false
7,875
1043F
Problem - 1043F - Codeforces =============== xa0 ]( "Codeforces Round #519 by Botan Investments — анонс") xa0— the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, ldots, a_n$$$ ($$$1 le a_i le 300,000$$$). Output If there is no subset of the given sequence wit...
2,500
true
false
false
true
false
false
false
false
false
false
5,478
1042A
There are $$$n$$$ benches in the Berland Central park. It is known that $$$a_i$$$ people are currently sitting on the $$$i$$$-th bench. Another $$$m$$$ people are coming to the park and each of them is going to have a seat on some bench out of $$$n$$$ available. Let $$$k$$$ be the maximum number of people sitting on on...
1,100
false
false
true
false
false
false
false
true
false
false
5,489
2008C
Today, Sakurako was studying arrays. An array $$$a$$$ of length $$$n$$$ is considered good if and only if: the array $$$a$$$ is increasing, meaning $$$a_{i - 1} < a_i$$$ for all $$$2 le i le n$$$; the differences between adjacent elements are increasing, meaning $$$a_i - a_{i-1} < a_{i+1} - a_i$$$ for all $$$2 le i <...
800
true
false
false
false
false
false
true
true
false
false
206
1903F
Theofanis wants to play video games, however he should also take care of his sister. Since Theofanis is a CS major, he found a way to do both. He will install some cameras in his house in order to make sure his sister is okay. His house is an undirected graph with $$$n$$$ nodes and $$$m$$$ edges. His sister likes to pl...
2,500
false
false
false
false
true
false
false
true
false
true
891
808B
It's been almost a week since Polycarp couldn't get rid of insomnia. And as you may already know, one week in Berland lasts _k_ days! When Polycarp went to a doctor with his problem, the doctor asked him about his sleeping schedule (more specifically, the average amount of hours of sleep per week). Luckily, Polycarp ke...
1,300
true
false
true
false
true
false
false
false
false
false
6,534
85A
We all know the problem about the number of ways one can tile a 2u2009×u2009_n_ field by 1u2009×u20092 dominoes. You probably remember that it goes down to Fibonacci numbers. We will talk about some other problem below, there you also are going to deal with tiling a rectangular field with dominoes. You are given a 4u20...
1,300
false
false
true
false
false
true
false
false
false
false
9,546
868F
Problem - 868F - 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
true
false
false
false
false
false
false
6,268
1242C
Ujan has a lot of numbers in his boxes. He likes order and balance, so he decided to reorder the numbers. There are $$$k$$$ boxes numbered from $$$1$$$ to $$$k$$$. The $$$i$$$-th box contains $$$n_i$$$ integer numbers. The integers can be negative. All of the integers are distinct. Ujan is lazy, so he will do the follo...
2,400
false
false
false
true
false
false
false
false
false
true
4,487
1556C
William has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a sequence of positive integers $$$c_1, c_2, dots, c_n$$$ where $$$c_i$$$ is the number of consecutive brackets "(" if $$$i$$$ is an odd number or the number of consecutive brackets ")" if $$$i$$$ is an even numbe...
1,800
false
false
true
false
false
false
true
false
false
false
2,853
339E
Xenia the horse breeder has _n_ (_n_u2009>u20091) horses that stand in a row. Each horse has its own unique number. Initially, the _i_-th left horse has number _i_. That is, the sequence of numbers of horses in a row looks as follows (from left to right): 1, 2, 3, ..., _n_. Xenia trains horses before the performance. D...
2,700
false
true
false
false
false
true
false
false
false
false
8,476
97E
After a revolution in Berland the new dictator faced an unexpected challenge: the country has to be somehow ruled. The dictator is a very efficient manager, yet he can't personally give orders to each and every citizen. That's why he decided to pick some set of leaders he would control. Those leaders will directly orde...
2,200
false
false
false
false
false
false
false
false
false
true
9,497
858F
All Berland residents are waiting for an unprecedented tour of wizard in his Blue Helicopter over the cities of Berland! It is well-known that there are _n_ cities in Berland, some pairs of which are connected by bidirectional roads. Each pair of cities is connected by no more than one road. It is not guaranteed that t...
2,300
false
false
false
false
false
true
false
false
false
true
6,309
930D
Consider the following game for two players. There is one white token and some number of black tokens. Each token is placed on a plane in a point with integer coordinates _x_ and _y_. The players take turn making moves, white starts. On each turn, a player moves all tokens of their color by 1 to up, down, left or right...
2,500
false
false
true
false
true
false
false
false
false
false
5,983
1574E
A matrix of size $$$n imes m$$$, such that each cell of it contains either $$$0$$$ or $$$1$$$, is considered beautiful if the sum in every contiguous submatrix of size $$$2 imes 2$$$ is exactly $$$2$$$, i.u2009e. every "square" of size $$$2 imes 2$$$ contains exactly two $$$1$$$'s and exactly two $$$0$$$'s. You are ...
2,500
true
false
true
false
false
true
false
false
false
false
2,770
792A
There are _n_ cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers _a_1,u2009_a_2,u2009...,u2009_a__n_. All coordinates are pairwise distinct. It is possible to get from one city to another only by bus. But all buses and roads are very old, so the Minister of Tra...
1,100
false
false
true
false
false
false
false
false
true
false
6,613
2001D
You are given an integer sequence $$$a_1, a_2, ldots, a_n$$$. Let $$$S$$$ be the set of all possible non-empty subsequences of $$$a$$$ without duplicate elements. Your goal is to find the longest sequence in $$$S$$$. If there are multiple of them, find the one that minimizes lexicographical order after multiplying term...
1,900
false
true
true
false
true
true
true
false
false
false
252
1279B
New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus. Vasya's verse contains $$$n$$$ parts. It takes $$$a_i$$$ seconds to recite the $$$i$$$-th part. Vasya can't change the order of parts in the verse: firstly he recites the part which takes $$$a_1$$$ seconds, secondl...
1,300
false
false
true
false
false
false
true
true
false
false
4,299
160E
The main Bertown street is represented by a straight line. There are 109 bus stops located on the line. The stops are numbered with integers from 1 to 109 in the order in which they follow on the road. The city has _n_ buses. Every day the _i_-th bus drives from stop number _s__i_ to stop number _f__i_ (_s__i_u2009<u20...
2,400
false
false
false
false
true
false
false
true
true
false
9,231
1498F
Alice and Bob are going to celebrate Christmas by playing a game with a tree of presents. The tree has $$$n$$$ nodes (numbered $$$1$$$ to $$$n$$$, with some node $$$r$$$ as its root). There are $$$a_i$$$ presents are hanging from the $$$i$$$-th node. Before beginning the game, a special integer $$$k$$$ is chosen. The g...
2,500
true
false
false
true
true
false
false
false
false
false
3,176
702D
Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to _d_ kilometers. Vasiliy's car is not new — it breaks after driven every _k_ kilometers and Vasiliy needs _t_ seconds to repair it. After repairing his car Vasiliy can drive again (but after _k_ kilometers i...
1,900
true
false
false
false
false
false
false
false
false
false
7,014
303E
Imagine a real contest or exam of _n_ participants. Every participant will get a particular score. We can predict the standings board more or less, if we do some statistics on their previous performance. Let's say the score of the participants will be uniformly distributed in interval [_l__i_,u2009_r__i_] (the score ca...
3,000
true
false
false
true
false
false
false
false
false
false
8,619
1877C
Chaneka, a gamer kid, invented a new gaming controller called joyboard. Interestingly, the joyboard she invented can only be used to play one game. The joyboard has a screen containing $$$n+1$$$ slots numbered from $$$1$$$ to $$$n+1$$$ from left to right. The $$$n+1$$$ slots are going to be filled with an array of non-...
1,200
true
false
false
false
false
false
false
false
false
false
1,018
1000D
The sequence of integers $$$a_1, a_2, dots, a_k$$$ is called a good array if $$$a_1 = k - 1$$$ and $$$a_1 > 0$$$. For example, the sequences $$$[3, -1, 44, 0], [1, -99]$$$ are good arrays, and the sequences $$$[3, 7, 8], [2, 5, 4, 1], [0]$$$ — are not. A sequence of integers is called good if it can be divided into a p...
1,900
false
false
false
true
false
false
false
false
false
false
5,702
747E
A rare article in the Internet is posted without a possibility to comment it. On a Polycarp's website each article has comments feed. Each comment on Polycarp's website is a non-empty string consisting of uppercase and lowercase letters of English alphabet. Comments have tree-like structure, that means each comment exc...
1,700
false
false
true
false
false
false
false
false
false
false
6,806
917A
As Will is stuck in the Upside Down, he can still communicate with his mom, Joyce, through the Christmas lights (he can turn them on and off with his mind). He can't directly tell his mom where he is, because the monster that took him to the Upside Down will know and relocate him. Thus, he came up with a puzzle to tell...
1,800
true
true
true
true
false
false
false
false
false
false
6,063
804F
In Isart people don't die. There are _n_ gangs of criminals. The _i_-th gang contains _s__i_ evil people numerated from 0 to _s__i_u2009-u20091. Some of these people took part in a big mine robbery and picked one gold bullion each (these people are given in the input). That happened 10100 years ago and then all of the ...
3,400
false
false
false
true
false
false
false
false
false
true
6,540
1379F1
Note that the difference between easy and hard versions is that in hard version unavailable cells can become available again and in easy version can't. You can make hacks only if all versions are solved. Ildar and Ivan are tired of chess, but they really like the chessboard, so they invented a new game. The field is a ...
2,700
false
false
false
false
true
false
false
true
false
false
3,773
8D
Two neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square. Once they went to the cinema, and the film impressed them so deeply, that when they left the cinema, they did not want to stop discussing it. Bob wants...
2,600
false
false
false
false
false
false
false
true
false
false
9,952
1420C1
This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved. Pikachu is a cute and friendly pokémon living in the wild pikachu herd. But it has become known recently that infamous team R w...
1,300
false
true
false
true
false
true
false
false
false
false
3,578
1093E
You are given two permutations $$$a$$$ and $$$b$$$, both consisting of $$$n$$$ elements. Permutation of $$$n$$$ elements is such a integer sequence that each value from $$$1$$$ to $$$n$$$ appears exactly once in it. You are asked to perform two types of queries with them: $$$1~l_a~r_a~l_b~r_b$$$ — calculate the number...
2,400
false
false
false
false
true
false
false
false
false
false
5,240
1615G
Problem - 1615G - Codeforces =============== xa0 ]( "Codeforces Global Round 18") . The value of the array you obtain is the number of integers $$$k$$$ from $$$1$$$ to $$$n$$$ such that the following condition holds: there exist a pair of adjacent elements equal to $$$k$$$ (i.u2009e. there exists some $$$i...
3,300
false
false
false
false
false
true
false
false
false
false
2,558
510A
Problem - 510A - 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
7,800
1285B
Today, Yasser and Adel are at the shop buying cupcakes. There are $$$n$$$ cupcake types, arranged from $$$1$$$ to $$$n$$$ on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type $$$i$$$ is an integer $$$a_i$$$. There are both tasty and nasty cupcakes, so the tastiness can be positiv...
1,300
false
true
true
true
false
false
false
false
false
false
4,266
2020C
Problem - 2020C - Codeforces =============== xa0 and Divide By Zero 9.0]( --- 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 co...
1,400
true
false
true
false
false
false
false
false
false
false
150
651A
Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at _a_1 percent and second one is charged at _a_2 percent. You can connect charger to a joystick only at the beginning of each minute. In one minute joystick either discharges by 2 percent (if n...
1,100
true
true
true
true
false
false
false
false
false
false
7,212
1634E
Even a cat has things it can do that AI cannot. — Fei-Fei Li You are given $$$m$$$ arrays of positive integers. Each array is of even length. You need to split all these integers into two equal multisets $$$L$$$ and $$$R$$$, that is, each element of each array should go into one of two multisets (but not both). Additio...
2,400
false
false
false
false
true
true
false
false
false
true
2,442
462A
Problem - 462A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,000
false
false
true
false
false
false
true
false
false
false
7,991
1368C
# Even Picture Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 512 megabytes Leo Jr. draws pictures in his notebook with checkered sheets (that is, each sheet has a regular square grid printed on it). We can assume that the sheets are infinitely large in any direction. To ...
1,500
false
false
false
false
false
true
false
false
false
false
3,834
1740I
In the world of Compfestnesia, Pak Chanek discovers a secret underground dungeon. Inside it, there is a treasure chest that is surrounded by $$$n$$$ statues that are arranged in a circular manner. The statues are numbered from $$$0$$$ to $$$n-1$$$ with statue $$$i$$$ being to the left of statue $$$i+1$$$ and statue $$$...
3,500
false
false
false
true
true
false
false
false
false
true
1,839
750F
This is an interactive problem. In the interaction section below you will find the information about flushing the output. The New Year tree of height _h_ is a perfect binary tree with vertices numbered 1 through 2_h_u2009-u20091 in some order. In this problem we assume that _h_ is at least 2. The drawing below shows on...
2,800
false
false
true
false
false
true
false
false
false
false
6,788
2025F
You are given an array $$$a$$$, consisting of $$$n$$$ integers (numbered from $$$1$$$ to $$$n$$$). Initially, they are all zeroes. You have to process $$$q$$$ queries. The $$$i$$$-th query consists of two different integers $$$x_i$$$ and $$$y_i$$$. During the $$$i$$$-th query, you have to choose an integer $$$p$$$ (whi...
2,700
false
true
false
true
false
true
false
false
false
true
118
300E
Problem - 300E - 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
true
false
false
false
false
false
false
true
false
false
8,631
1148E
There are $$$n$$$ stones arranged on an axis. Initially the $$$i$$$-th stone is located at the coordinate $$$s_i$$$. There may be more than one stone in a single place. You can perform zero or more operations of the following type: take two stones with indices $$$i$$$ and $$$j$$$ so that $$$s_i leq s_j$$$, choose an i...
2,300
true
true
false
false
false
true
false
false
true
false
4,973
1958H
Monocarp plays a fantasy RPG. His character is a mage, so he casts spells. There are two types of spells he knows — basic spells and composite spells. There are $$$n$$$ basic spells in Monocarp's spell book, numbered from $$$1$$$ to $$$n$$$. Each basic spell simply changes the health of the target: either decreases it ...
2,600
false
false
false
true
false
false
false
false
false
false
519
1918G
Problem - 1918G - 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,700
true
false
false
false
false
true
false
false
false
false
782
845B
Problem - 845B - Codeforces =============== xa0 — this string denotes Luba's ticket. The ticket can start with the digit 0. Output Print one number — the minimum possible number of digits Luba needs to replace to make the ticket lucky. Examples Input 000000 Output 0 Input 123456 Output 2 Input 111000 ...
1,600
false
true
true
false
false
false
true
false
false
false
6,383
1477A
$$$n$$$ distinct integers $$$x_1,x_2,ldots,x_n$$$ are written on the board. Nezzar can perform the following operation multiple times. Select two integers $$$x,y$$$ (not necessarily distinct) on the board, and write down $$$2x-y$$$. Note that you don't remove selected numbers. Now, Nezzar wonders if it is possible to ...
1,800
true
false
false
false
false
true
false
false
false
false
3,290
835F
In the Kingdom K., there are _n_ towns numbered with integers from 1 to _n_. The towns are connected by _n_ bi-directional roads numbered with integers from 1 to _n_. The _i_-th road connects the towns _u__i_ and _v__i_ and its length is _l__i_. There is no more than one road between two towns. Also, there are no roads...
2,500
false
false
false
true
false
false
false
false
false
true
6,422