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
1859F
There are $$$n$$$ cities in Byteland, some of which are connected by roads, which can be traversed in any direction. The $$$i$$$-th road has its own hardness parameter $$$w_i$$$. Time spent on traversing a road with its hardness equal to $$$w_i$$$ is $$$lceilfrac{w_i}{c} ceil$$$, where $$$c$$$ is the current driving sk...
3,200
false
false
false
false
true
false
false
false
false
true
1,126
1651C
There is a classroom with two rows of computers. There are $$$n$$$ computers in each row and each computer has its own grade. Computers in the first row has grades $$$a_1, a_2, dots, a_n$$$ and in the second rowxa0β€” $$$b_1, b_2, dots, b_n$$$. Initially, all pairs of neighboring computers in each row are connected by wi...
1,500
false
false
true
false
true
false
true
false
false
false
2,366
568E
Note that the memory limit in this problem is less than usual. Let's consider an array consisting of positive integers, some positions of which contain gaps. We have a collection of numbers that can be used to fill the gaps. Each number from the given collection can be used at most once. Your task is to determine such ...
3,000
false
false
false
true
true
false
false
false
false
false
7,574
1165F1
The only difference between easy and hard versions is constraints. Ivan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wants to use some of these microtransactions β€” and he won't start playing until he gets all of them. Eac...
2,000
false
true
false
false
false
false
false
true
false
false
4,891
1996D
Problem - 1996D - 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,500
true
false
false
false
false
false
true
true
false
false
287
1688C
As a human, she can erase history of its entirety. As a Bai Ze (Hakutaku), she can create history out of nothingness. β€”Perfect Memento in Strict Sense Keine has the ability to manipulate history. The history of Gensokyo is a string $$$s$$$ of length $$$1$$$ initially. To fix the chaos caused by Yukari, she needs to do ...
1,700
false
true
false
false
false
true
false
false
false
false
2,149
997B
Problem - 997B - 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
false
false
true
false
false
false
5,717
228E
Berland has _n_ cities, some of them are connected by bidirectional roads. For each road we know whether it is asphalted or not. The King of Berland Valera II wants to asphalt all roads of Berland, for that he gathered a group of workers. Every day Valera chooses exactly one city and orders the crew to asphalt all road...
1,900
false
false
false
false
false
false
false
false
false
true
8,924
1220C
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 le k < s$$$). At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and righ...
1,300
false
true
false
false
false
false
false
false
false
false
4,571
2027D1
This is the easy version of this problem. The only difference is that you only need to output the minimum total cost of operations in this version. You must solve both versions to be able to hack. You're given an array $$$a$$$ of length $$$n$$$, and an array $$$b$$$ of length $$$m$$$ ($$$b_i > b_{i+1}$$$ for all $$$1 l...
1,700
false
true
true
true
false
false
false
true
false
true
107
1852F
The red pandas are in town to meet their relatives, the blue pandas! The town is modeled by a number line. The pandas have already planned their meetup, but the schedule keeps changing. You are given $$$q$$$ updates of the form x t c. If $$$c < 0$$$, it means $$$c$$$ more red pandas enter the number line at position $...
3,500
false
false
false
true
true
false
false
false
false
false
1,162
1118C
Let's call some square matrix with integer values in its cells palindromic if it doesn't change after the order of rows is reversed and it doesn't change after the order of columns is reversed. For example, the following matrices are palindromic: The following matrices are not palindromic because they change after the ...
1,700
false
false
true
false
false
true
false
false
false
false
5,100
283E
Farmer John is hosting a tennis tournament with his _n_ cows. Each cow has a skill level _s__i_, and no two cows having the same skill level. Every cow plays every other cow exactly once in the tournament, and each cow beats every cow with skill level lower than its own. However, Farmer John thinks the tournament will ...
2,800
true
false
false
false
true
false
false
false
false
false
8,699
1012F
Gleb is a famous competitive programming teacher from Innopolis. He is planning a trip to _N_ programming camps in the nearest future. Each camp will be held in a different country. For each of them, Gleb needs to apply for a visa. For each of these trips Gleb knows three integers: the number of the first day of the tr...
3,400
false
false
true
true
false
false
false
false
false
false
5,622
1180A
Problem - 1180A - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
true
false
true
true
false
false
false
false
false
false
4,816
1514B
Problem - 1514B - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,200
true
false
false
false
false
false
false
false
false
false
3,095
940C
And where the are the phone numbers? You are given a string _s_ consisting of lowercase English letters and an integer _k_. Find the lexicographically smallest string _t_ of length _k_, such that its set of letters is a subset of the set of letters of _s_ and _s_ is lexicographically smaller than _t_. It's guaranteed t...
1,500
false
false
true
false
false
true
false
false
false
false
5,936
515C
Problem - 515C - 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
true
false
false
false
false
false
false
true
false
7,773
1252E
Andi is a mathematician, a computer scientist, and a songwriter. After spending so much time writing songs, he finally writes a catchy melody that he thought as his best creation. However, the singer who will sing the song/melody has a unique vocal range, thus, an adjustment may be needed. A melody is defined as a sequ...
2,200
false
true
false
false
false
false
false
false
false
false
4,430
892B
Problem - 892B - 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
true
true
false
false
false
false
false
false
false
6,182
733B
Very soon there will be a parade of victory over alien invaders in Berland. Unfortunately, all soldiers died in the war and now the army consists of entirely new recruits, many of whom do not even know from which leg they should begin to march. The civilian population also poorly understands from which leg recruits beg...
1,100
true
false
false
false
false
false
false
false
false
false
6,863
629C
As Famil Door’s birthday is coming, some of his friends (like Gabi) decided to buy a present for him. His friends are going to buy a string consisted of round brackets since Famil Door loves string of brackets of length _n_ more than any other strings! The sequence of round brackets is called valid if and only if: 1. t...
2,000
false
false
false
true
false
false
false
false
false
false
7,307
576E
Note the unusual memory limit for this problem. You are given an undirected graph consisting of _n_ vertices and _m_ edges. The vertices are numbered with integers from 1 to _n_, the edges are numbered with integers from 1 to _m_. Each edge can be unpainted or be painted in one of the _k_ colors, which are numbered wit...
3,300
false
false
false
false
true
false
false
true
false
false
7,539
1172D
Nauuo is a girl who loves playing games related to portals. One day she was playing a game as follows. In an $$$n imes n$$$ grid, the rows are numbered from $$$1$$$ to $$$n$$$ from top to bottom, the columns are numbered from $$$1$$$ to $$$n$$$ from left to right. We denote a cell on the intersection of the $$$r$$$-th ...
2,900
false
false
false
false
false
true
false
false
false
false
4,856
438D
At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important things were lost, in particular the favorite sequence of Picks. Fortunately, Picks remembers how to repair the sequence. Initially he should create an integer array _a_[1],u2009_a_[2],u2009...,u20...
2,300
true
false
false
false
true
false
false
false
false
false
8,086
1045D
In the intergalactic empire Bubbledom there are $$$N$$$ planets, of which some pairs are directly connected by two-way wormholes. There are $$$N-1$$$ wormholes. The wormholes are of extreme religious importance in Bubbledom, a set of planets in Bubbledom consider themselves one intergalactic kingdom if and only if any ...
2,200
true
false
false
false
false
false
false
false
false
false
5,467
1935D
The Master's Assistance Center has announced an entrance exam, which consists of the following. The candidate is given a set $$$s$$$ of size $$$n$$$ and some strange integer $$$c$$$. For this set, it is needed to calculate the number of pairs of integers $$$(x, y)$$$ such that $$$0 leq x leq y leq c$$$, $$$x + y$$$ is ...
1,800
true
false
true
false
false
false
false
true
false
false
671
1176E
You are given an undirected unweighted connected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. It is guaranteed that there are no self-loops or multiple edges in the given graph. Your task is to choose at most $$$lfloorfrac{n}{2} floor$$$ vertices in this graph so each unchosen vertex is adjacent (in other wo...
1,700
false
false
false
false
false
false
false
false
false
true
4,834
1089G
Berland State University invites people from all over the world as guest students. You can come to the capital of Berland and study with the best teachers in the country. Berland State University works every day of the week, but classes for guest students are held on the following schedule. You know the sequence of sev...
1,500
true
false
false
false
false
false
false
false
false
false
5,279
815E
It's been long after the events of the previous problems, and Karen has now moved on from student life and is looking to relocate to a new neighborhood. The neighborhood consists of _n_ houses in a straight line, labelled 1 to _n_ from left to right, all an equal distance apart. Everyone in this neighborhood loves peac...
2,900
false
false
true
false
false
true
false
true
false
false
6,496
114B
When little Petya grew up and entered the university, he started to take part in АБМ contests. Later he realized that he doesn't like how the АБМ contests are organised: the team could only have three members (and he couldn't take all his friends to the competitions and distribute the tasks between the team members eff...
1,500
false
false
false
false
false
false
true
false
false
true
9,429
1394D
Since Boboniu finished building his Jianghu, he has been doing Kungfu on these mountains every day. Boboniu designs a map for his $$$n$$$ mountains. He uses $$$n-1$$$ roads to connect all $$$n$$$ mountains. Every pair of mountains is connected via roads. For the $$$i$$$-th mountain, Boboniu estimated the tiredness of d...
2,800
false
true
false
true
false
false
false
false
true
false
3,698
853D
Michael has just bought a new electric car for moving across city. Michael does not like to overwork, so each day he drives to only one of two his jobs. Michael's day starts from charging his electric car for getting to the work and back. He spends 1000 burles on charge if he goes to the first job, and 2000 burles if h...
2,400
false
true
false
true
false
false
false
true
false
false
6,331
291A
Polycarpus is the director of a large corporation. There are _n_ secretaries working for the corporation, each of them corresponds via the famous Spyke VoIP system during the day. We know that when two people call each other via Spyke, the Spyke network assigns a unique ID to this call, a positive integer session numbe...
800
false
false
true
false
false
false
false
false
true
false
8,671
1739C
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x > y$$$. Two players, Alex and Boris, play this game. In the beginnin...
1,500
false
false
false
true
false
true
false
false
false
false
1,851
1917A
You are given an array of integers $$$a_1, a_2, dots, a_n$$$. You can perform the following operation any number of times (possibly zero): Choose any element $$$a_i$$$ from the array and change its value to any integer between $$$0$$$ and $$$a_i$$$ (inclusive). More formally, if $$$a_i < 0$$$, replace $$$a_i$$$ with a...
800
true
false
false
false
false
true
false
false
false
false
794
371C
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (...
1,600
false
false
false
false
false
false
true
true
false
false
8,346
1182A
Problem - 1182A - 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,000
true
false
false
true
false
false
false
false
false
false
4,808
1080F
It is a very important day for Katya. She has a test in a programming class. As always, she was given an interesting problem that she solved very fast. Can you solve that problem? You are given $$$n$$$ ordered segments sets. Each segment can be represented as a pair of two integers $$$[l, r]$$$ where $$$lleq r$$$. Each...
2,400
false
false
false
false
true
false
false
false
true
false
5,324
760A
Problem - 760A - Codeforces =============== xa0 (8VC Venture Cup 2017 - Final Round Div. 2 Edition)]( --- 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 ...
800
true
false
true
false
false
false
false
false
false
false
6,751
1513A
A sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once. Given two integers $$$n$$$ and $$$k$$$, construct a permutation $$$a$$$ of numbers from $$$1$$$ to $$$n$$$ which has exactly $$$k$$$ peaks. An index $$$i$$$ of an array $$$a$$$ of size $$$n$$$ is sai...
800
false
false
true
false
false
true
false
false
false
false
3,102
552E
Problem - 552E - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,100
false
true
true
true
false
false
true
false
false
false
7,623
1560C
Polycarp has found a table having an infinite number of rows and columns. The rows are numbered from $$$1$$$, starting from the topmost one. The columns are numbered from $$$1$$$, starting from the leftmost one. Initially, the table hasn't been filled and Polycarp wants to fix it. He writes integers from $$$1$$$ and so...
800
true
false
true
false
false
false
false
false
false
false
2,828
938G
You are given an undirected connected graph with weighted edges. The length of some path between two vertices is the bitwise xor of weights of all edges belonging to this path (if some edge is traversed more than once, then it is included in bitwise xor the same number of times). There are three types of queries you ha...
2,900
false
false
false
false
true
false
false
false
false
true
5,945
1028G
This problem is interactive. You should guess hidden number $$$x$$$ which is between $$$1$$$ and $$$M = 10004205361450474$$$, inclusive. You could use up to $$$5$$$ queries. In each query, you can output an increasing sequence of $$$k leq x$$$ integers, each between $$$1$$$ and $$$M$$$, inclusive, and you will obtain o...
3,000
false
false
false
true
false
false
false
false
false
false
5,563
1264D1
This is the easy version of this problem. The only difference is the limit of $$$n$$$ - the length of the input string. In this version, $$$1 leq n leq 2000$$$. The hard version of this challenge is not offered in the round for the second division. Let's define a correct bracket sequence and its depth as follow: An em...
2,600
false
false
false
true
false
false
false
false
false
false
4,378
1473D
You are given a program that consists of $$$n$$$ instructions. Initially a single variable $$$x$$$ is assigned to $$$0$$$. Afterwards, the instructions are of two types: increase $$$x$$$ by $$$1$$$; decrease $$$x$$$ by $$$1$$$. You are given $$$m$$$ queries of the following format: query $$$l$$$ $$$r$$$xa0β€” how many...
1,700
false
false
true
true
true
false
false
false
false
false
3,314
1430E
Problem - 1430E - 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
false
true
false
false
true
false
false
false
false
false
3,512
1669E
Given $$$n$$$ strings, each of length $$$2$$$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and the $$$i$$$-th string and the $$$j$$$-th string differ in exactly one position. In other words, count the number of pairs $$$(i, j)$...
1,200
true
false
false
false
true
false
false
false
false
false
2,261
1807B
Mihai and Bianca are playing with bags of candies. They have a row $$$a$$$ of $$$n$$$ bags of candies. The $$$i$$$-th bag has $$$a_i$$$ candies. The bags are given to the players in the order from the first bag to the $$$n$$$-th bag. If a bag has an even number of candies, Mihai grabs the bag. Otherwise, Bianca grabs t...
800
false
true
false
false
false
false
false
false
false
false
1,434
37A
Problem - 37A - Codeforces =============== xa0 ") β€” the number of bars at Vasya’s disposal. The second line contains _N_ space-separated integers _l__i_ β€” the lengths of the bars. All the lengths are natural numbers not exceeding 1000. Output In one line output two numbers β€” the height of the largest towe...
1,000
false
false
false
false
false
false
false
false
true
false
9,813
1440B
A median of an array of integers of length $$$n$$$ is the number standing on the $$$lceil {frac{n}{2}} ceil$$$ (rounding up) position in the non-decreasing ordering of its elements. Positions are numbered starting with $$$1$$$. For example, a median of the array $$$[2, 6, 4, 1, 3, 5]$$$ is equal to $$$3$$$. There exis...
900
true
true
false
false
false
false
false
false
false
false
3,465
418E
In order to ensure confidentiality, the access to the "Russian Code Cup" problems is password protected during the problem development process. To select a password, the jury can generate a special table that contains _n_ columns and the infinite number of rows. To construct a table, the first row is fixed, and all the...
3,100
false
false
false
false
true
false
false
false
false
false
8,151
601D
You are given a tree _T_ with _n_ vertices (numbered 1 through _n_) and a letter in each vertex. The tree is rooted at vertex 1. Let's look at the subtree _T__v_ of some vertex _v_. It is possible to read a string along each simple path starting at _v_ and ending at some vertex in _T__v_ (possibly _v_ itself). Let's de...
2,400
false
false
false
false
true
false
false
false
false
false
7,437
986F
Surely you have seen insane videos by South Korean rapper PSY, such as "Gangnam Style", "Gentleman" and "Daddy". You might also hear that PSY has been recording video "Oppa Funcan Style" two years ago (unfortunately we couldn't find it on the internet). We will remind you what this hit looked like (you can find origina...
3,300
true
false
false
false
false
false
false
false
false
true
5,767
1876B
Chaneka has an array $$$[a_1,a_2,ldots,a_n]$$$. Initially, all elements are white. Chaneka will choose one or more different indices and colour the elements at those chosen indices black. Then, she will choose all white elements whose indices are multiples of the index of at least one black element and colour those ele...
1,500
false
false
false
false
false
false
false
false
true
false
1,025
632E
Problem - 632E - Codeforces =============== xa0 . Find all the possible total costs of products the thief can nick into his knapsack. Input The first line contains two integers _n_ and _k_ (1u2009≀u2009_n_,u2009_k_u2009≀u20091000) β€” the number of kinds of products and the number of products the thief will tak...
2,400
true
false
false
true
false
false
false
false
false
false
7,277
1491B
There is a graph of $$$n$$$ rows and $$$10^6 + 2$$$ columns, where rows are numbered from $$$1$$$ to $$$n$$$ and columns from $$$0$$$ to $$$10^6 + 1$$$: Let's denote the node in the row $$$i$$$ and column $$$j$$$ by $$$(i, j)$$$. Initially for each $$$i$$$ the $$$i$$$-th row has exactly one obstacle β€” at node $$$(i, a_...
1,200
true
false
false
false
false
false
true
false
false
false
3,221
1428H
This is an interactive problem. To prevent the mischievous rabbits from freely roaming around the zoo, Zookeeper has set up a special lock for the rabbit enclosure. This lock is called the Rotary Laser Lock. The lock consists of $$$n$$$ concentric rings numbered from $$$0$$$ to $$$n-1$$$. The innermost ring is ring $$$...
3,500
false
false
false
false
false
false
false
true
false
false
3,517
1779D
Boris thinks that chess is a tedious game. So he left his tournament early and went to a barber shop as his hair was a bit messy. His current hair can be described by an array $$$a_1,a_2,ldots, a_n$$$, where $$$a_i$$$ is the height of the hair standing at position $$$i$$$. His desired haircut can be described by an arr...
1,700
false
true
false
true
true
true
false
false
true
false
1,599
634A
A remote island chain contains _n_ islands, labeled 1 through _n_. Bidirectional bridges connect the islands to form a simple cyclexa0β€” a bridge connects islands 1 and 2, islands 2 and 3, and so on, and additionally a bridge connects islands _n_ and 1. The center of each island contains an identical pedestal, and all b...
1,300
false
false
true
false
false
true
false
false
false
false
7,267
1730C
You have a string $$$s$$$ consisting of digits from $$$0$$$ to $$$9$$$ inclusive. You can perform the following operation any (possibly zero) number of times: You can choose a position $$$i$$$ and delete a digit $$$d$$$ on the $$$i$$$-th position. Then insert the digit $$$min{(d + 1, 9)}$$$ on any position (at the beg...
1,200
true
true
false
false
true
false
false
false
true
false
1,909
622E
Problem - 622E - Codeforces =============== xa0 ]( "Educational Codeforces Round 7") β€” the number of vertices in the tree. Each of the next _n_u2009-u20091 lines contains two integers _x__i_,u2009_y__i_ (1u2009≀u2009_x__i_,u2009_y__i_u2009≀u2009_n_) β€” the ends of the _i_-th edge. It is guaranteed that you ...
2,200
false
true
false
false
false
false
false
false
true
false
7,342
1196D2
The only difference between easy and hard versions is the size of the input. You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'. You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ...
1,600
false
false
true
true
true
false
false
false
false
false
4,718
1332G
Given a sequence of integers $$$a$$$ of length $$$n$$$, a tuple $$$(i,j,k)$$$ is called monotone triples if $$$1 le i<j<kle n$$$; $$$a_i le a_j le a_k$$$ or $$$a_i ge a_j ge a_k$$$ is satisfied. For example, $$$a=[5,3,4,5]$$$, then $$$(2,3,4)$$$ is monotone triples for sequence $$$a$$$ while $$$(1,3,4)$$$ is not. Bob...
3,100
false
false
false
false
true
false
false
false
false
false
4,044
1847D
Josuke is tired of his peaceful life in Morioh. Following in his nephew Jotaro's footsteps, he decides to study hard and become a professor of computer science. While looking up competitive programming problems online, he comes across the following one: Let $$$s$$$ be a binary string of length $$$n$$$. An operation on ...
1,900
false
true
true
false
true
false
false
false
false
false
1,197
725C
Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the same letter written on them. Here is an example of a grid: ABCDEFGHIJKLM NOPQRSTUVWXYZ We say that two tiles are adjacent if...
1,600
false
false
true
false
false
true
true
false
false
false
6,905
97A
Little Gennady was presented with a set of domino for his birthday. The set consists of 28 different dominoes of size 2u2009Γ—u20091. Both halves of each domino contain one digit from 0 to 6. 0-0 0-1 0-2 0-3 0-4 0-5 0-6 1-1 1-2 1-3 1-4 1-5 1-6 2-2 2-3 2-4 2-5 2-6 3-3 3-4 3-5 3-6 4-4 4-5 4-6 5-5 5-6 6-6 The figure...
2,400
false
false
true
false
false
false
true
false
false
false
9,501
814B
Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized. On that night, Sengoku constructed a permutation _p_1,u2009_p_2,u2009...,u2009_p__n_ o...
1,300
false
false
false
false
false
true
false
false
false
false
6,504
1098C
Misha walked through the snowy forest and he was so fascinated by the trees to decide to draw his own tree! Misha would like to construct a rooted tree with $$$n$$$ vertices, indexed from 1 to $$$n$$$, where the root has index 1. Every other vertex has a parent $$$p_i$$$, and $$$i$$$ is called a child of vertex $$$p_i$...
2,400
false
true
false
false
false
true
false
true
false
true
5,214
1082E
Problem - 1082E - 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,000
false
true
false
true
false
false
false
true
false
false
5,311
1152F2
This problem is same as the previous one, but has larger constraints. Aki is playing a new video game. In the video game, he will control Neko, the giant cat, to fly between planets in the Catniverse. There are $$$n$$$ planets in the Catniverse, numbered from $$$1$$$ to $$$n$$$. At the beginning of the game, Aki choose...
3,000
false
false
false
true
false
false
false
false
false
false
4,950
827B
Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist of _n_ nodes connected with minimum possible number of wires into one network (a wire directly connects two nodes). Exactly _k_ of the nodes should be exit-nodes, that means that each of them should...
1,800
false
true
true
false
false
true
false
false
false
false
6,454
700C
Again, there are hard times in Berland! Many towns have such tensions that even civil war is possible. There are _n_ towns in Reberland, some pairs of which connected by two-way roads. It is not guaranteed that it is possible to reach one town from any other town using these roads. Towns _s_ and _t_ announce the final ...
2,600
false
false
false
false
false
false
false
false
false
true
7,023
1722A
Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters. Today he wrote string $$$s$$$ of leng...
800
false
false
true
false
false
false
false
false
false
false
1,953
1976B
You are given two integer arrays: array $$$a$$$ of length $$$n$$$ and array $$$b$$$ of length $$$n+1$$$. You can perform the following operations any number of times in any order: choose any element of the array $$$a$$$ and increase it by $$$1$$$; choose any element of the array $$$a$$$ and decrease it by $$$1$$$; c...
1,100
false
true
true
false
false
false
false
false
false
false
432
1499D
Problem - 1499D - 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
true
false
false
true
false
false
false
false
false
false
3,172
841B
Problem - 841B - 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
true
false
false
false
false
false
false
false
false
false
6,397
1612D
You are given a pair of integers $$$(a, b)$$$ and an integer $$$x$$$. You can change the pair in two different ways: set (assign) $$$a := a - b$$$; set (assign) $$$b := a - b$$$, where $$$a - b$$$ is the absolute difference between $$$a$$$ and $$$b$$$. The pair $$$(a, b)$$$ is called $$$x$$$-magic if $$$x$$$ is obtai...
1,600
true
false
false
false
false
false
false
false
false
false
2,580
1594D
Theofanis started playing the new online game called "Among them". However, he always plays with Cypriot players, and they all have the same name: "Andreas" (the most common name in Cyprus). In each game, Theofanis plays with $$$n$$$ other players. Since they all have the same name, they are numbered from $$$1$$$ to $$...
1,700
false
false
false
true
false
true
false
false
false
true
2,675
1946F
Input Each test consists of several sets of input data. The first line contains a single integer $$$t$$$ ($$$1 le t le 10^4$$$)xa0β€” the number of sets of input data. The description of the sets of input data follows. The first line of each set of input data contains two integers $$$n$$$ and $$$q$$$ ($$$1 le n, q le 10^...
2,500
false
false
false
true
true
false
false
false
false
false
600
1593D1
This problem is a simplified version of D2, but it has significant differences, so read the whole statement. Polycarp has an array of $$$n$$$ ($$$n$$$ is even) integers $$$a_1, a_2, dots, a_n$$$. Polycarp conceived of a positive integer $$$k$$$. After that, Polycarp began performing the following operations on the arra...
1,100
true
false
false
false
false
false
false
false
false
false
2,683
916B
Jamie is preparing a Codeforces round. He has got an idea for a problem, but does not know how to solve it. Help him write a solution to the following problem: Find _k_ integers such that the sum of two to the power of each number equals to the number _n_ and the largest integer in the answer is as small as possible. A...
2,000
true
true
false
false
false
false
false
false
false
false
6,067
1157D
Polycarp has to solve exactly $$$n$$$ problems to improve his programming skill before an important programming competition. But this competition will be held very soon, most precisely, it will start in $$$k$$$ days. It means that Polycarp has exactly $$$k$$$ days for training! Polycarp doesn't want to procrastinate, s...
1,900
true
true
false
false
false
true
false
false
false
false
4,919
1444A
Oleg's favorite subjects are History and Math, and his favorite branch of mathematics is division. To improve his division skills, Oleg came up with $$$t$$$ pairs of integers $$$p_i$$$ and $$$q_i$$$ and for each pair decided to find the greatest integer $$$x_i$$$, such that: $$$p_i$$$ is divisible by $$$x_i$$$; $$$x_...
1,500
true
false
false
false
false
false
true
false
false
false
3,454
1830D
You are given a tree with $$$n$$$ nodes. For each node, you either color it in $$$0$$$ or $$$1$$$. The value of a path $$$(u,v)$$$ is equal to the MEX$$$^dagger$$$ of the colors of the nodes from the shortest path between $$$u$$$ and $$$v$$$. The value of a coloring is equal to the sum of values of all paths $$$(u,v)$$...
2,800
false
false
false
true
false
false
true
false
false
false
1,303
2021A
Pak Chanek has an array $$$a$$$ of $$$n$$$ positive integers. Since he is currently learning how to calculate the floored average of two numbers, he wants to practice it on his array $$$a$$$. While the array $$$a$$$ has at least two elements, Pak Chanek will perform the following three-step operation: 1. Pick two diffe...
800
true
true
false
false
true
false
false
false
true
false
146
1080B
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them. Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
900
true
false
false
false
false
false
false
false
false
false
5,328
1781D
You are given a set $$$a_1, a_2, ldots, a_n$$$ of distinct positive integers. We define the squareness of an integer $$$x$$$ as the number of perfect squares among the numbers $$$a_1 + x, a_2 + x, ldots, a_n + x$$$. Find the maximum squareness among all integers $$$x$$$ between $$$0$$$ and $$$10^{18}$$$, inclusive. Per...
1,800
true
false
false
false
false
false
true
false
false
false
1,585
341E
Iahub is playing an uncommon game. Initially, he has _n_ boxes, numbered 1, 2, 3, ..., _n_. Each box has some number of candies in it, described by a sequence _a_1, _a_2, ..., _a__n_. The number _a__k_ represents the number of candies in box _k_. The goal of the game is to move all candies into exactly two boxes. The r...
3,000
false
true
false
false
false
true
false
false
false
false
8,469
86A
Problem - 86A - Codeforces =============== xa0 ") which is obtained from _n_ by replacing every digit _a_ in the decimal notation of _n_ with the digit (9u2009u2009-u2009u2009_a_). We say that ψ(_n_) is the reflection of _n_. For example, reflection of 192 equals 807. Note that leading zeros (if any) shou...
1,600
true
false
false
false
false
false
false
false
false
false
9,541
1768C
You are given an array $$$a$$$ of $$$n$$$ integers. Find two permutations$$$^dagger$$$ $$$p$$$ and $$$q$$$ of length $$$n$$$ such that $$$max(p_i,q_i)=a_i$$$ for all $$$1 leq i leq n$$$ or report that such $$$p$$$ and $$$q$$$ do not exist. $$$^dagger$$$ A permutation of length $$$n$$$ is an array consisting of $$$n$$$ ...
1,300
false
true
true
false
false
true
false
false
true
false
1,689
1033A
Alice and Bob are playing chess on a huge chessboard with dimensions $$$n imes n$$$. Alice has a single piece leftxa0β€” a queen, located at $$$(a_x, a_y)$$$, while Bob has only the king standing at $$$(b_x, b_y)$$$. Alice thinks that as her queen is dominating the chessboard, victory is hers. But Bob has made a devious...
1,000
false
false
true
false
false
false
false
false
false
true
5,535
1092D2
Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches. The current state of the wall can be respresented by a sequence $$$a$$$ of $$$n$$$ integers, with $$$a_i$$$ being the heigh...
2,200
false
false
true
false
true
false
false
false
false
false
5,247
1562B
During the hypnosis session, Nicholas suddenly remembered a positive integer $$$n$$$, which doesn't contain zeros in decimal notation. Soon, when he returned home, he got curious: what is the maximum number of digits that can be removed from the number so that the number becomes not prime, that is, either composite or ...
1,000
true
false
true
false
false
true
true
false
false
false
2,819
1695D2
The only difference between this problem and D1 is the bound on the size of the tree. You are given an unrooted tree with $$$n$$$ vertices. There is some hidden vertex $$$x$$$ in that tree that you are trying to find. To do this, you may ask $$$k$$$ queries $$$v_1, v_2, ldots, v_k$$$ where the $$$v_i$$$ are vertices in...
2,300
false
true
false
true
false
true
false
false
false
false
2,110
1836A
John is a lead programmer on a destroyer belonging to the space navy of the Confederacy of Independent Operating Systems. One of his tasks is checking if the electronic brains of robots were damaged during battles. A standard test is to order the robots to form one or several lines, in each line the robots should stand...
800
false
false
true
false
false
false
false
false
true
false
1,272
1211D
Problem - 1211D - Codeforces =============== xa0 ]( "Kotlin Heroes: Episode 2") . The second line contains the sequence of player's ratings β€” integers $$$r_1, r_2, dots, r_n$$$ ($$$1 le r_i le 10^6$$$). Output Print only one integer β€” the maximum number of teams that can be composed from $$$n$$$ given play...
2,000
true
true
false
false
false
false
false
true
false
false
4,625
1408I
Problem - 1408I - Codeforces =============== xa0 ]( "Grakn Forces 2020 $$$, $$$1 leq k leq 16$$$, $$$1 leq c leq 16$$$). The second line contains $$$n$$$ distinct integers $$$a_1, a_2, ldots, a_n$$$ ($$$k leq a_i leq 2^c-1$$$). Output Print $$$2^c$$$ integers: the probability that the bitwise XOR is equal ...
3,200
true
false
false
true
false
false
false
false
false
false
3,628
1848B
In the summer, Vika likes to visit her country house. There is everything for relaxation: comfortable swings, bicycles, and a river. There is a wooden bridge over the river, consisting of $$$n$$$ planks. It is quite old and unattractive, so Vika decided to paint it. And in the shed, they just found cans of paint of $$$...
1,200
true
true
true
false
true
false
false
true
true
false
1,193