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
222E
Recently a top secret mission to Mars has taken place. As a result, scientists managed to obtain some information about the Martian DNA. Now we know that any Martian DNA contains at most _m_ different nucleotides, numbered from 1 to _m_. Special characteristics of the Martian DNA prevent some nucleotide pairs from foll...
1,900
false
false
false
true
false
false
false
false
false
false
8,948
1988B
You are given a sequence $$$[a_1,ldots,a_n]$$$ where each element $$$a_i$$$ is either $$$0$$$ or $$$1$$$. You can apply several (possibly zero) operations to the sequence. In each operation, you select two integers $$$1le lle rle a$$$ (where $$$a$$$ is the current length of $$$a$$$) and replace $$$[a_l,ldots,a_r]$$$ wi...
900
false
true
true
false
false
false
false
false
false
false
346
850B
Arpa has found a list containing _n_ numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1. Arpa can perform two types of operations: Choose a number and delete it with cost _x_. Choose a number and increase it by 1 with cost _y_. Arpa...
2,100
false
false
true
false
false
false
false
false
false
false
6,350
246C
General Payne has a battalion of _n_ soldiers. The soldiers' beauty contest is coming up, it will last for _k_ days. Payne decided that his battalion will participate in the pageant. Now he has choose the participants. All soldiers in the battalion have different beauty that is represented by a positive integer. The va...
1,600
false
true
false
false
false
true
true
false
false
false
8,846
538A
A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that contains someone else's word. The word on the banner consists only of upper-case ...
1,400
false
false
true
false
false
false
true
false
false
false
7,688
845G
Problem - 845G - Codeforces =============== xa0 . You have to find the minimum length of path between vertex 1 and vertex _n_. Note that graph can contain multiple edges and loops. It is guaranteed that the graph is connected. Input The first line contains two numbers _n_ and _m_ (1u2009≤u2009_n_u2009≤u20...
2,300
true
false
false
false
false
false
false
false
false
true
6,378
1608F
Problem - 1608F - 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 - ...
3,200
false
false
true
true
false
false
false
false
false
false
2,610
1735D
You like the card board game "Set". Each card contains $$$k$$$ features, each of which is equal to a value from the set $$${0, 1, 2}$$$. The deck contains all possible variants of cards, that is, there are $$$3^k$$$ different cards in total. A feature for three cards is called good if it is the same for these cards or ...
1,700
true
false
false
false
true
false
true
false
false
false
1,877
763A
Each New Year Timofey and his friends cut down a tree of _n_ vertices and bring it home. After that they paint all the _n_ its vertices, so that the _i_-th vertex gets color _c__i_. Now it's time for Timofey birthday, and his mother asked him to remove the tree. Timofey removes the tree in the following way: he takes s...
1,600
false
false
true
true
false
false
false
false
false
true
6,737
685B
After the piece of a devilish mirror hit the Kay's eye, he is no longer interested in the beauty of the roses. Now he likes to watch snowflakes. Once upon a time, he found a huge snowflake that has a form of the tree (connected acyclic graph) consisting of _n_ nodes. The root of tree has index 1. Kay is very interested...
1,900
false
false
false
true
true
false
false
false
false
false
7,082
1556D
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Deltix Round, Summer 2021 (open for everyone, rated, Div. 1 + Div. 2) Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported...
1,800
true
false
false
false
false
true
false
false
false
false
2,852
190E
Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has _n_ cities, numbered from 1 to _n_, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if and only if there is in fact no road between this pair of cities (w...
2,100
false
false
false
false
true
false
false
false
true
true
9,078
245H
Problem - 245H - 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,800
false
false
false
true
false
false
false
false
false
false
8,849
870A
Problem - 870A - Codeforces =============== xa0 ") ") representation has at least one digit from the first list and at least one digit from the second list. What is the smallest positive pretty integer? Input The first line contains two integers _n_ and _m_ (1u2009≤u2009_n_,u2009_m_u2009≤u20099) — the leng...
900
false
false
true
false
false
false
true
false
false
false
6,261
174A
A group of _n_ merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volume in each of the _n_ mugs must be the same. Polycarpus has already began the ...
1,100
true
false
false
false
false
false
false
false
false
false
9,168
463D
Problem - 463D - 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
true
false
false
false
false
false
true
7,986
358B
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other. Dima and Inna are using a secret code in their text messages. W...
1,500
false
false
false
false
false
false
true
false
false
false
8,403
373A
Cucumber boy is fan of Kyubeat, a famous music game. Kyubeat has 16 panels for playing arranged in 4u2009×u20094 table. When a panel lights up, he has to press that panel. Each panel has a timing to press (the preffered time when a player should press it), and Cucumber boy is able to press at most _k_ panels in a time ...
900
false
false
true
false
false
false
false
false
false
false
8,338
522D
Problem - 522D - Codeforces =============== xa0 ]( "VK Cup 2015 — Квалификация 1") . For each query you need to print the minimum distance between such pair of elements _a__x_ and _a__y_ (_x_u2009≠u2009_y_), that: both indexes of the elements lie within range
2,000
false
false
false
false
true
false
false
false
false
false
7,747
414E
After a lot of trying, Mashmokh designed a problem and it's your job to solve it. You have a tree _T_ with _n_ vertices. Each vertex has a unique index from 1 to _n_. The root of _T_ has index 1. For each vertex of this tree _v_, you are given a list of its children in a specific order. You must perform three types of ...
3,200
false
false
false
false
true
false
false
false
false
false
8,165
939E
Problem - 939E - 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,800
false
true
false
false
false
false
false
true
false
false
5,940
2013B
Eralim, being the mafia boss, manages a group of $$$n$$$ fighters. Fighter $$$i$$$ has a rating of $$$a_i$$$. Eralim arranges a tournament of $$$n - 1$$$ battles, in each of which two not yet eliminated fighters $$$i$$$ and $$$j$$$ ($$$1 le i < j le n$$$) are chosen, and as a result of the battle, fighter $$$i$$$ is el...
900
true
true
false
false
false
true
false
false
false
false
177
235D
In computer science, there is a method called "Divide And Conquer By Node" to solve some hard problems about paths on a tree. Let's desribe how this method works by function: _solve_(_t_) (_t_ is a tree): 1. Chose a node _x_ (it's common to chose weight-center) in tree _t_. Let's call this step "Line A". 2. Deal with a...
3,000
false
false
false
false
false
false
false
false
false
true
8,893
1148G
Consider an undirected graph $$$G$$$ with $$$n$$$ vertices. There is a value $$$a_i$$$ in each vertex. Two vertices $$$i$$$ and $$$j$$$ are connected with an edge if and only if $$$gcd(a_i, a_j) > 1$$$, where $$$gcd(x, y)$$$ denotes the where all vertices are fair or all vertices are not fair. One can show that such a ...
3,300
true
false
false
false
false
true
false
false
false
true
4,971
1427D
You are given a deck of $$$n$$$ cards numbered from $$$1$$$ to $$$n$$$ (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation. Choose $$$2 le k le n$$$ and split the deck in $$$k$$$ nonempty contiguous parts $$$D_1, D_2,dots, D_k$$$ ($$$D_1$$$ contains the first $$$...
2,000
false
false
true
false
false
true
false
false
false
false
3,530
747F
Problem - 747F - 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
true
false
false
true
false
false
true
false
false
false
6,805
1418E
You are playing a computer game. In this game, you have to fight $$$n$$$ monsters. To defend from monsters, you need a shield. Each shield has two parameters: its current durability $$$a$$$ and its defence rating $$$b$$$. Each monster has only one parameter: its strength $$$d$$$. When you fight a monster with strength ...
2,400
false
false
false
false
false
false
false
true
false
false
3,590
1428F
Zookeeper is buying a carton of fruit to feed his pet wabbit. The fruits are a sequence of apples and oranges, which is represented by a binary string $$$s_1s_2ldots s_n$$$ of length $$$n$$$. $$$1$$$ represents an apple and $$$0$$$ represents an orange. Since wabbit is allergic to eating oranges, Zookeeper would like t...
2,400
false
false
false
true
true
false
false
true
false
false
3,520
819E
Problem - 819E - 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,800
false
false
false
false
false
true
false
false
false
true
6,476
765D
Problem - 765D - 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,700
true
false
false
false
false
true
false
false
false
false
6,727
322A
Problem - 322A - 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
true
false
false
false
false
false
false
false
false
8,546
641E
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset. Artem wants to create a basic multiset of integers. He wants these structure to support operations of three type...
2,000
false
false
false
false
true
false
false
false
false
false
7,247
1136A
After lessons Nastya decided to read a book. The book contains $$$n$$$ chapters, going one after another, so that one page of the book belongs to exactly one chapter and each chapter contains at least one page. Yesterday evening Nastya did not manage to finish reading the book, so she marked the page with number $$$k$$...
800
false
false
true
false
false
false
false
false
false
false
5,047
1409F
You are given two strings $$$s$$$ and $$$t$$$ consisting of lowercase Latin letters. The length of $$$t$$$ is $$$2$$$ (i.e. this string consists only of two characters). In one move, you can choose any character of $$$s$$$ and replace it with any lowercase Latin letter. More formally, you choose some $$$i$$$ and replac...
2,100
false
false
false
true
false
false
false
false
false
false
3,622
2039C2
This is the hard version of the problem. The differences between the two versions are highlighted in bold. You can only make hacks if both versions of the problem are solved. Shohag has two integers $$$x$$$ and $$$m$$$. Help him count the number of integers $$$1 le y le m$$$ such that $$$x oplus y$$$ is divisible$$$^{ ...
1,800
true
false
false
false
false
false
true
false
false
false
21
1353C
You are given a board of size $$$n imes n$$$, where $$$n$$$ is odd (not divisible by $$$2$$$). Initially, each cell of the board contains one figure. In one move, you can select exactly one figure presented in some cell and move it to one of the cells sharing a side or a corner with the current cell, i.e. from the cel...
1,000
true
false
false
false
false
false
false
false
false
false
3,943
405C
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix. The dot product of two integer number vectors _x_ and _y_ of size _n_ is the sum of the products of the corresponding components of the vectors. The unusual square of an _n_u2009×u2009_n_ sq...
1,600
true
false
true
false
false
false
false
false
false
false
8,203
1260B
You are given two integers $$$a$$$ and $$$b$$$. You may perform any number of operations on them (possibly zero). During each operation you should choose any positive integer $$$x$$$ and set $$$a := a - x$$$, $$$b := b - 2x$$$ or $$$a := a - 2x$$$, $$$b := b - x$$$. Note that you may choose different values of $$$x$$$ ...
1,300
true
false
false
false
false
false
false
true
false
false
4,393
1365G
2,800
true
false
false
false
false
true
false
false
false
false
3,851
300B
A programming coach has _n_ students to teach. We know that _n_ is divisible by 3. Let's assume that all students are numbered from 1 to _n_, inclusive. Before the university programming championship the coach wants to split all students into groups of three. For some pairs of students we know that they want to be on t...
1,500
false
false
false
false
false
false
true
false
false
true
8,634
1666C
Problem - 1666C - 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,800
false
false
false
false
false
true
true
false
false
false
2,283
1805D
You are given a tree (a connected graph without cycles) with $$$n$$$ vertices. Consider a fixed integer $$$k$$$. Then, the graph $$$G_k$$$ is an undirected graph with $$$n$$$ vertices, where an edge between vertices $$$u$$$ and $$$v$$$ exists if and only if the distance between vertices $$$u$$$ and $$$v$$$ in the given...
1,800
false
true
false
true
false
false
false
false
false
true
1,446
1060D
You invited $$$n$$$ guests to dinner! You plan to arrange one or more circles of chairs. Each chair is going to be either occupied by one guest, or be empty. You can make any number of circles. Your guests happen to be a little bit shy, so the $$$i$$$-th guest wants to have a least $$$l_i$$$ free chairs to the left of ...
1,900
true
true
false
false
false
false
false
false
false
false
5,413
175B
Vasya has been playing Plane of Tanks with his friends the whole year. Now it is time to divide the participants into several categories depending on their results. A player is given a non-negative integer number of points in each round of the Plane of Tanks. Vasya wrote results for each round of the last year. He has ...
1,400
false
false
true
false
false
false
false
false
false
false
9,164
100I
Problem - 100I - Codeforces =============== xa0 , around the origin. What is the result of this rotation? Input A single integer _k_ (0u2009≤u2009_k_u2009<u2009360) is given in the first line. Two integer numbers _x_ and _y_ are given in the second line (u2009-u20091390u2009≤u2009_x_,u2009_y_u2009≤u20091390)....
1,500
true
false
false
false
false
false
false
false
false
false
9,481
1473E
You are given a weighted undirected 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. Let's define the weight of the path consisting of $$$k$$$ edges with indices $$$e_1, e_2, dots, e_k$$$ as $$$sumlimits_{i=1}^{k}{w_{e_...
2,400
false
false
false
false
false
false
false
false
false
true
3,313
2009E
Problem - 2009E - 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
false
true
false
false
196
331C1
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 ...
1,100
false
false
false
true
false
false
false
false
false
false
8,518
301D
Problem - 301D - 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,200
false
false
false
false
true
false
false
false
false
false
8,627
1729C
Polycarp was given a row of tiles. Each tile contains one lowercase letter of the Latin alphabet. The entire sequence of tiles forms the string $$$s$$$. In other words, you are given a string $$$s$$$ consisting of lowercase Latin letters. Initially, Polycarp is on the first tile of the row and wants to get to the last ...
1,100
false
false
false
false
false
true
false
false
false
false
1,916
711A
ZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has _n_ rows of seats. There are 4 seats in each row, and the seats are separated into pairs by a walkway. When ZS and Chris came, some places in the bus was already occupied. ZS and Chris ar...
800
false
false
true
false
false
false
true
false
false
false
6,976
523A
Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the vertical line, that is, the right part of the image moves to the left, and vice ...
1,200
false
false
true
false
false
false
false
false
false
false
7,746
1081G
Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following: Chouti found his idea dumb since obviously, this "merge sort" somet...
3,200
true
false
false
false
false
false
false
false
false
false
5,317
894B
Problem - 894B - 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,800
true
false
false
false
false
true
false
false
false
false
6,174
234E
In the autumn of this year, two Russian teams came into the group stage of the most prestigious football club competition in the world — the UEFA Champions League. Now, these teams have already started to play in the group stage and are fighting for advancing to the playoffs. In this problem we are interested in the dr...
1,600
false
false
true
false
false
false
false
false
false
false
8,900
1731C
You are given an integer array $$$a_1, a_2, dots, a_n$$$ ($$$1 le a_i le n$$$). Find the number of subarrays of $$$a$$$ whose $$$operatorname{XOR}$$$ has an even number of divisors. In other words, find all pairs of indices $$$(i, j)$$$ ($$$i le j$$$) such that $$$a_i oplus a_{i + 1} oplus dots oplus a_j$$$ has an even...
1,700
true
false
false
false
false
false
true
false
false
false
1,903
1612F
Monocarp plays a computer game. There are $$$n$$$ different sets of armor and $$$m$$$ different weapons in this game. If a character equips the $$$i$$$-th set of armor and wields the $$$j$$$-th weapon, their power is usually equal to $$$i + j$$$; but some combinations of armor and weapons synergize well. Formally, ther...
2,800
false
true
false
true
false
false
true
false
false
false
2,578
935D
Ancient Egyptians are known to have used a large set of symbols to write on the walls of the temples. Fafa and Fifa went to one of the temples and found two non-empty words _S_1 and _S_2 of equal lengths on the wall of temple written one below the other. Since this temple is very ancient, some symbols from the words we...
1,900
true
false
false
false
false
false
false
false
false
false
5,961
353E
You have a directed acyclic graph _G_, consisting of _n_ vertexes, numbered from 0 to _n_u2009-u20091. The graph contains _n_ edges numbered from 0 to _n_u2009-u20091. An edge with number _i_ connects vertexes _i_ and (_i_u2009+u20091)xa0_mod_xa0_n_, and it can be directed in either direction (from _i_ to (_i_u2009+u20...
2,200
false
true
false
true
false
false
false
false
false
false
8,419
776A
Our beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his powers of deduction, he came to know that the killer has a strategy for selecting his next victim. The killer starts with two potential victims on his first day, selects one of these two, kills selected v...
900
false
false
true
false
false
false
true
false
false
false
6,668
1701C
There are $$$n$$$ workers and $$$m$$$ tasks. The workers are numbered from $$$1$$$ to $$$n$$$. Each task $$$i$$$ has a value $$$a_i$$$xa0— the index of worker who is proficient in this task. Every task should have a worker assigned to it. If a worker is proficient in the task, they complete it in $$$1$$$ hour. Otherwis...
1,400
false
true
true
false
false
false
false
true
false
false
2,074
572B
In this task you need to process a set of stock exchange orders and use them to create order book. An order is an instruction of some participant to buy or sell stocks on stock exchange. The order number _i_ has price _p__i_, direction _d__i_ — buy or sell, and integer _q__i_. This means that the participant is ready t...
1,300
false
true
true
false
true
false
false
false
true
false
7,560
645G
After a drawn-out mooclear arms race, Farmer John and the Mischievous Mess Makers have finally agreed to establish peace. They plan to divide the territory of Bovinia with a line passing through at least two of the _n_ outposts scattered throughout the land. These outposts, remnants of the conflict, are located at the ...
3,200
false
false
false
false
false
false
false
true
false
false
7,228
773D
In the country of Never, there are _n_ cities and a well-developed road system. There is exactly one bidirectional road between every pair of cities, thus, there are as many as roads! No two roads intersect, and no road passes through intermediate cities. The art of building tunnels and bridges has been mastered by Nev...
2,700
false
false
false
true
false
false
false
false
false
true
6,684
1062F
There are $$$n$$$ cities in the kingdom $$$X$$$, numbered from $$$1$$$ through $$$n$$$. People travel between cities by some one-way roads. As a passenger, JATC finds it weird that from any city $$$u$$$, he can't start a trip in it and then return back to it using the roads of the kingdom. That is, the kingdom can be v...
2,900
false
false
false
false
false
false
false
false
false
true
5,397
47E
Bertown is under siege! The attackers have blocked all the ways out and their cannon is bombarding the city. Fortunately, Berland intelligence managed to intercept the enemies' shooting plan. Let's introduce the Cartesian system of coordinates, the origin of which coincides with the cannon's position, the _Ox_ axis is ...
2,200
false
false
false
false
true
false
false
false
true
false
9,738
1141D
There are $$$n$$$ left boots and $$$n$$$ right boots. Each boot has a color which is denoted as a lowercase Latin letter or a question mark ('?'). Thus, you are given two strings $$$l$$$ and $$$r$$$, both of length $$$n$$$. The character $$$l_i$$$ stands for the color of the $$$i$$$-th left boot and the character $$$r_...
1,500
false
true
true
false
false
false
false
false
false
false
5,018
1842E
There are $$$n$$$ pairwise-distinct points and a line $$$x+y=k$$$ on a two-dimensional plane. The $$$i$$$-th point is at $$$(x_i,y_i)$$$. All points have non-negative coordinates and are strictly below the line. Alternatively, $$$0 leq x_i,y_i, x_i+y_i < k$$$. Tenzing wants to erase all the points. He can perform the f...
2,300
true
true
false
true
true
false
false
false
false
false
1,235
1833A
Vlad decided to compose a melody on his guitar. Let's represent the melody as a sequence of notes corresponding to the characters 'a', 'b', 'c', 'd', 'e', 'f', and 'g'. However, Vlad is not very experienced in playing the guitar and can only record exactly two notes at a time. Vlad wants to obtain the melody $$$s$$$, a...
800
false
false
true
false
false
false
false
false
false
false
1,291
140B
As meticulous Gerald sets the table, Alexander finished another post on Codeforces and begins to respond to New Year greetings from friends. Alexander has _n_ friends, and each of them sends to Alexander exactly one e-card. Let us number his friends by numbers from 1 to _n_ in the order in which they send the cards. Le...
1,800
false
true
true
false
false
false
true
false
false
false
9,317
1809F
There are $$$n$$$ cities in Berland, arranged in a circle and numbered from $$$1$$$ to $$$n$$$ in clockwise order. You want to travel all over Berland, starting in some city, visiting all the other cities and returning to the starting city. Unfortunately, you can only drive along the Berland Ring Highway, which connect...
2,500
false
true
true
false
true
false
false
true
false
true
1,415
778B
Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer _m_, bit depth of the game, which means that all numbers in the game will consist of _m_ bits. Then he asks Peter to choose some _m_-bit number. After t...
1,800
false
false
true
false
false
false
true
false
false
false
6,655
766A
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem. Given two strings _a_ and _b_, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence o...
1,000
false
false
false
false
false
true
false
false
false
false
6,723
1103D
Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are $$$n$$$ judges now in the layer and you are trying to pass the entrance exam. You have a number $$$k$$$ — your skill in Cardbluff. Each judge has a number $$$a_i$$$ — an indicator of u...
3,100
false
false
false
true
false
false
false
false
false
false
5,184
1789B
Serval has a string $$$s$$$ that only consists of 0 and 1 of length $$$n$$$. The $$$i$$$-th character of $$$s$$$ is denoted as $$$s_i$$$, where $$$1leq ileq n$$$. Serval can perform the following operation called Inversion Magic on the string $$$s$$$: Choose an segment $$$[l, r]$$$ ($$$1leq lleq rleq n$$$). For $$$lle...
800
false
false
true
false
false
false
true
false
false
false
1,547
958F2
There is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. Master Heidi needs to select the Jedi Knights who will go on peacekeeping missions throughout the galaxy. It is well-known that the success of any peacekeeping mission depends on the colors of th...
1,800
false
false
false
false
false
false
false
true
false
false
5,879
187E
The story was not finished as PMP thought. God offered him one more chance to reincarnate and come back to life. But before he can come back, God told him that PMP should ask _n_ great men including prominent programmers about their life experiences. The men are standing on a straight line. They are numbered 1 through ...
2,900
false
true
false
false
true
false
false
false
false
false
9,093
527D
The clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph _G_. It is required to find a subset of vertices _C_ of the maximum size such that any two of them are connected by an edge in graph _G_. Sounds simple, doesn't ...
1,800
false
true
true
true
true
false
false
false
true
false
7,721
1068B
Problem - 1068B - Codeforces =============== xa0 ]( "A") $$$. Output Print one numberxa0— answer for the problem. Examples Input 1 Output 1 Input 2 Output 2 Note In the first example $$$
1,200
true
false
false
false
false
false
false
false
false
false
5,369
371B
Two little greedy bears have found two pieces of cheese in the forest of weight _a_ and _b_ grams, correspondingly. The bears are so greedy that they are ready to fight for the larger piece. That's where the fox comes in and starts the dialog: "Little bears, wait a little, I want to make your pieces equal" "Come off it...
1,300
true
false
false
false
false
false
false
false
false
false
8,347
1761C
You are given a binary matrix $$$b$$$ (all elements of the matrix are $$$0$$$ or $$$1$$$) of $$$n$$$ rows and $$$n$$$ columns. You need to construct a $$$n$$$ sets $$$A_1, A_2, ldots, A_n$$$, for which the following conditions are satisfied: Each set is nonempty and consists of distinct integers between $$$1$$$ and $$...
1,400
false
true
false
false
false
true
false
false
false
true
1,746
1671E
You are given a rooted tree of $$$2^n - 1$$$ vertices. Every vertex of this tree has either $$$0$$$ children, or $$$2$$$ children. All leaves of this tree have the same distance from the root, and for every non-leaf vertex, one of its children is the left one, and the other child is the right one. Formally, you are giv...
2,100
false
false
false
true
false
false
false
false
true
false
2,247
1165F2
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
true
false
false
false
false
true
false
false
4,890
1183B
There are $$$n$$$ products in the shop. The price of the $$$i$$$-th product is $$$a_i$$$. The owner of the shop wants to equalize the prices of all products. However, he wants to change prices smoothly. In fact, the owner of the shop can change the price of some product $$$i$$$ in such a way that the difference between...
900
true
false
false
false
false
false
false
false
false
false
4,801
257D
Problem - 257D - 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
true
false
false
false
false
false
false
false
false
8,804
913B
Problem - 913B - Codeforces =============== xa0 . Each of the next _n_u2009-u20091 lines contains one integer _p__i_ (1u2009≤u2009_i_u2009≤u2009_n_u2009-u20091)xa0— the index of the parent of the _i_u2009+u20091-th vertex (1u2009≤u2009_p__i_u2009≤u2009_i_). Vertex 1 is the root. It's guaranteed that the r...
1,200
false
false
true
false
false
false
false
false
false
false
6,090
1198A
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of $$$n$$$ non-negative integers. If there are exactly $$$K$$$ distinct values in the array, then we need $$$...
1,600
false
false
false
false
false
false
false
false
true
false
4,709
1917D
You are given a permutation $$$p_0, p_1, ldots, p_{n-1}$$$ of odd integers from $$$1$$$ to $$$2n-1$$$ and a permutation $$$q_0, q_1, ldots, q_{k-1}$$$ of integers from $$$0$$$ to $$$k-1$$$. An array $$$a_0, a_1, ldots, a_{nk-1}$$$ of length $$$nk$$$ is defined as follows: $$$a_{i cdot k+j}=p_i cdot 2^{q_j}$$$ for all $...
2,300
true
false
true
true
true
false
false
false
false
false
791
1202B
Suppose you have a special $$$x$$$-$$$y$$$-counter. This counter can store some value as a decimal number; at first, the counter has value $$$0$$$. The counter performs the following algorithm: it prints its lowest digit and, after that, adds either $$$x$$$ or $$$y$$$ to its value. So all sequences this counter generat...
1,700
false
false
false
true
false
false
true
false
false
false
4,688
733A
Problem - 733A - 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
false
false
false
false
6,864
1705F
Mark is administering an online exam consisting of $$$n$$$ true-false questions. However, he has lost all answer keys. He needs a way to retrieve the answers before his client gets infuriated. Fortunately, he has access to the grading system. Thus, for each query, you can input the answers to all $$$n$$$ questions, and...
2,900
false
false
false
false
false
true
false
false
false
false
2,041
1332E
Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an $$$n imes m$$$ grid. Initially $$$a_{i,j}$$$ cubes are stacked up in the cell $$$(i,j)$$$. Two cells are called adjacent if they share a side. Player can perform the following operations: stack up one cube in two adjacent cells; s...
2,100
true
false
false
false
false
true
false
false
false
false
4,046
1343E
You are given an undirected unweighted graph consisting of $$$n$$$ vertices and $$$m$$$ edges (which represents the map of Bertown) and the array of prices $$$p$$$ of length $$$m$$$. It is guaranteed that there is a path between each pair of vertices (districts). Mike has planned a trip from the vertex (district) $$$a$...
2,100
false
true
false
false
false
false
true
false
true
true
3,989
1644F
For an array of integers $$$a$$$, let's define $$$a$$$ as the number of elements in it. Let's denote two functions: $$$F(a, k)$$$ is a function that takes an array of integers $$$a$$$ and a positive integer $$$k$$$. The result of this function is the array containing $$$a$$$ first elements of the array that you get by...
2,900
true
false
false
false
false
false
false
false
false
false
2,396
522C
Polycarp is flying in the airplane. Finally, it is his favorite time — the lunchtime. The BerAvia company stewardess is giving food consecutively to all the passengers from the 1-th one to the last one. Polycarp is sitting on seat _m_, that means, he will be the _m_-th person to get food. The flight menu has _k_ dishes...
2,100
false
true
false
false
false
false
false
false
false
false
7,748
1849C
You are given a string $$$s$$$ consisting of $$$n$$$ characters 0 and/or 1. You make $$$m$$$ copies of this string, let the $$$i$$$-th copy be the string $$$t_i$$$. Then you perform exactly one operation on each of the copies: for the $$$i$$$-th copy, you sort its substring $$$[l_i; r_i]$$$ (the substring from the $$$l...
1,600
false
false
false
false
true
false
true
true
false
false
1,186
245E
Problem - 245E - 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
true
false
false
false
false
false
false
false
8,852
935F
Problem - 935F - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,600
false
true
false
false
true
false
false
false
false
false
5,959
1494F
You are given an undirected connected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. Your goal is to destroy all edges of the given graph. You may choose any vertex as the starting one and begin walking from it along the edges. When you walk along an edge, you destroy it. Obviously, you cannot walk along an ed...
2,900
false
false
true
false
false
true
true
false
false
true
3,197
1618A
Polycarp had an array $$$a$$$ of $$$3$$$ positive integers. He wrote out the sums of all non-empty subsequences of this array, sorted them in non-decreasing order, and got an array $$$b$$$ of $$$7$$$ integers. For example, if $$$a = {1, 4, 3}$$$, then Polycarp wrote out $$$1$$$, $$$4$$$, $$$3$$$, $$$1 + 4 = 5$$$, $$$1 ...
800
true
false
false
false
false
false
false
false
true
false
2,542