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
592C
Vector Willman and Array Bolt are the two most famous athletes of Byteforces. They are going to compete in a race with a distance of _L_ meters today. Willman and Bolt have exactly the same speed, so when they compete the result is always a tie. That is a problem for the organizers because they want a winner. While wat...
1,800
true
false
false
false
false
false
false
false
false
false
7,480
12B
Problem - 12B - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so...
1,100
false
false
true
false
false
false
false
false
true
false
9,934
15E
Problem - 15E - Codeforces =============== xa0 ") . After a long time at home Peter decided to yield to his granny's persuasions and step out for a breath of fresh air. Being prudent, Peter plans the route beforehand. The route, that Peter considers the most suitable, has the following characteristics...
2,600
false
false
false
true
false
false
false
false
false
false
9,916
254A
Problem - 254A - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,200
false
false
false
false
false
true
false
false
true
false
8,819
1955D
Maxim has an array $$$a$$$ of $$$n$$$ integers and an array $$$b$$$ of $$$m$$$ integers ($$$m le n$$$). Maxim considers an array $$$c$$$ of length $$$m$$$ to be good if the elements of array $$$c$$$ can be rearranged in such a way that at least $$$k$$$ of them match the elements of array $$$b$$$. For example, if $$$b =...
1,400
false
false
false
false
true
false
false
false
false
false
545
1737C
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Dytechlab Cup 2022 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 see...
1,500
true
false
true
false
false
true
false
false
false
false
1,866
1717B
Madoka decided to participate in an underground sports programming competition. And there was exactly one task in it: A square table of size $$$n imes n$$$, where $$$n$$$ is a multiple of $$$k$$$, is called good if only the characters '.' and 'X' are written in it, as well as in any subtable of size $$$1 imes k$$$ or...
1,100
false
false
true
false
false
true
false
false
false
false
1,980
977E
You are given an undirected graph consisting of $$$n$$$ vertices and $$$m$$$ edges. Your task is to find the number of connected components which are cycles. Here are some definitions of graph theory. An undirected graph consists of two sets: set of nodes (called vertices) and set of edges. Each edge connects a pair of...
1,500
false
false
false
false
false
false
false
false
false
true
5,820
1288D
You are given $$$n$$$ arrays $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$; each array consists of exactly $$$m$$$ integers. We denote the $$$y$$$-th element of the $$$x$$$-th array as $$$a_{x, y}$$$. You have to choose two arrays $$$a_i$$$ and $$$a_j$$$ ($$$1 le i, j le n$$$, it is possible that $$$i = j$$$). After that, you w...
2,000
false
false
false
true
false
false
false
true
false
false
4,249
1423C
As you may already know, DuΕ‘an is keen on playing with railway models. He has a big map with cities that are connected with railways. His map can be seen as a graph where vertices are cities and the railways connecting them are the edges. So far, the graph corresponding to his map is a tree. As you already know, a tree...
3,500
false
false
false
false
false
false
false
false
false
true
3,561
659G
Long ago, Vasily built a good fence at his country house. Vasily calls a fence good, if it is a series of _n_ consecutively fastened vertical boards of centimeter width, the height of each in centimeters is a positive integer. The house owner remembers that the height of the _i_-th board to the left is _h__i_. Today Va...
2,300
false
false
false
true
false
false
false
false
false
false
7,183
1647B
Madoka's father just reached $$$1$$$ million subscribers on Mathub! So the website decided to send him a personalized awardxa0β€” The Mathhub's Bit Button! The Bit Button is a rectangular table with $$$n$$$ rows and $$$m$$$ columns with $$$0$$$ or $$$1$$$ in each cell. After exploring the table Madoka found out that: A ...
1,200
false
false
true
false
false
true
true
false
false
true
2,388
590A
A schoolboy named Vasya loves reading books on programming and mathematics. He has recently read an encyclopedia article that described the method of median smoothing (or median filter) and its many applications in science and engineering. Vasya liked the idea of the method very much, and he decided to try it in practi...
1,700
false
false
true
false
false
false
false
false
false
false
7,489
1451B
Hr0d1y has $$$q$$$ queries on a binary string $$$s$$$ of length $$$n$$$. A binary string is a string containing only characters '0' and '1'. A query is described by a pair of integers $$$l_i$$$, $$$r_i$$$ $$$(1 leq l_i lt r_i leq n)$$$. For each query, he has to determine whether there exists a good subsequence in $$$s...
900
false
true
true
true
false
false
false
false
false
false
3,427
1954D
There are balls of $$$n$$$ different colors; the number of balls of the $$$i$$$-th color is $$$a_i$$$. The balls can be combined into groups. Each group should contain at most $$$2$$$ balls, and no more than $$$1$$$ ball of each color. Consider all $$$2^n$$$ sets of colors. For a set of colors, let's denote its value a...
1,800
true
false
false
true
false
false
false
false
true
false
551
431A
Problem - 431A - 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
8,119
1506B
You are given a number $$$k$$$ and a string $$$s$$$ of length $$$n$$$, consisting of the characters '.' and '*'. You want to replace some of the '*' characters with 'x' characters so that the following conditions are met: The first character '*' in the original string should be replaced with 'x'; The last character '...
1,100
false
true
true
false
false
false
false
false
false
false
3,142
1179D
Fedor runs for president of Byteland! In the debates, he will be asked how to solve Byteland's transport problem. It's a really hard problem because of Byteland's transport system is now a tree (connected graph without cycles). Fedor's team has found out in the ministry of transport of Byteland that there is money in t...
2,700
false
false
false
true
true
false
false
false
false
false
4,818
1305B
Now that Kuroni has reached 10 years old, he is a big boy and doesn't like arrays of integers as presents anymore. This year he wants a Bracket sequence as a Birthday present. More specifically, he wants a bracket sequence so complex that no matter how hard he tries, he will not be able to remove a simple subsequence! ...
1,200
false
true
false
false
false
true
false
false
false
false
4,163
897A
Are you going to Scarborough Fair?Parsley, sage, rosemary and thyme. Remember me to one who lives there. He once was the true love of mine. Willem is taking the girl to the highest building in island No.28, however, neither of them knows how to get there. Willem asks his friend, Grick for directions, Grick helped them,...
800
false
false
true
false
false
false
false
false
false
false
6,160
1922F
You are given an array $$$a_1, a_2, dots, a_n$$$, where each element is an integer from $$$1$$$ to $$$x$$$. You can perform the following operation with it any number of times: choose three integers $$$l$$$, $$$r$$$ and $$$k$$$ such that $$$1 le l le r le n$$$, $$$1 le k le x$$$ and each element $$$a_i$$$ such that $$...
2,500
false
false
false
true
false
false
false
false
false
false
753
797C
Problem - 797C - Codeforces =============== xa0 , consisting of lowercase English letters. Output Print resulting string _u_. Examples Input cab Output abc Input acdb Output abdc
1,700
false
true
false
false
true
false
false
false
false
false
6,585
1874E
It is well known that quick sort works by randomly selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. But Jellyfish thinks that choosing a random element is just a waste of time, so she always chooses the...
3,000
true
false
false
true
false
false
false
false
false
false
1,032
1184C2
The Cybermen solved that first test much quicker than the Daleks. Luckily for us, the Daleks were angry (shocking!) and they destroyed some of the Cybermen. After the fighting stopped, Heidi gave them another task to waste their time on. There are $$$n$$$ points on a plane. Given a radius $$$r$$$, find the maximum numb...
2,200
false
false
false
false
true
false
false
false
false
false
4,787
119C
Yet another education system reform has been carried out in Berland recently. The innovations are as follows: An academic year now consists of _n_ days. Each day pupils study exactly one of _m_ subjects, besides, each subject is studied for no more than one day. After the lessons of the _i_-th subject pupils get the ho...
2,000
false
false
false
true
false
false
false
false
false
false
9,409
730H
Polycarp is a beginner programmer. He is studying how to use a command line. Polycarp faced the following problem. There are _n_ files in a directory and he needs to delete some of them. Polycarp wants to run a single delete command with filename pattern as an argument. All the files to be deleted should match the patt...
1,300
false
false
true
false
false
true
false
false
false
false
6,881
777A
Bomboslav likes to look out of the window in his room and watch lads outside playing famous shell game. The game is played by two persons: operator and player. Operator takes three similar opaque shells and places a ball beneath one of them. Then he shuffles the shells by swapping some pairs and the player has to guess...
1,000
true
false
true
false
false
true
false
false
false
false
6,661
1365B
Ashish has $$$n$$$ elements arranged in a line. These elements are represented by two integers $$$a_i$$$xa0β€” the value of the element and $$$b_i$$$xa0β€” the type of the element (there are only two possible types: $$$0$$$ and $$$1$$$). He wants to sort the elements in non-decreasing values of $$$a_i$$$. He can perform th...
1,300
false
false
true
false
false
true
false
false
false
false
3,856
856A
Masha and Grisha like studying sets of positive integers. One day Grisha has written a set _A_ containing _n_ different integers _a__i_ on a blackboard. Now he asks Masha to create a set _B_ containing _n_ different integers _b__j_ such that all _n_2 integers that can be obtained by summing up _a__i_ and _b__j_ for all...
1,600
false
false
false
false
false
true
true
false
false
false
6,320
1860A
A bracket sequence is a string consisting of characters '(' and/or ')'. A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters '1' and '+' between the original characters of the sequence. For example: bracket sequences "()()" and "(())" are...
900
false
false
false
false
false
true
false
false
false
false
1,125
1942F
Farmer John has an array $$$a$$$ of length $$$n$$$. He also has a function $$$f$$$ with the following recurrence: $$$f(1) = sqrt{a_1}$$$; For all $$$i > 1$$$, $$$f(i) = sqrt{f(i-1)+a_i}$$$. Note that $$$f(i)$$$ is not necessarily an integer. He plans to do $$$q$$$ updates to the array. Each update, he gives you two i...
2,700
true
false
true
false
true
false
true
false
false
false
626
1955E
A binary string $$$s$$$ of length $$$n$$$ is given. A binary string is a string consisting only of the characters '1' and '0'. You can choose an integer $$$k$$$ ($$$1 le k le n$$$) and then apply the following operation any number of times: choose $$$k$$$ consecutive characters of the string and invert them, i.e., repl...
1,700
false
true
true
false
false
false
true
false
true
false
544
1416E
One day, BThero decided to play around with arrays and came up with the following problem: You are given an array $$$a$$$, which consists of $$$n$$$ positive integers. The array is numerated $$$1$$$ through $$$n$$$. You execute the following procedure exactly once: You create a new array $$$b$$$ which consists of $$$2...
3,200
false
true
false
true
true
false
false
true
false
false
3,598
1355D
Petya and Vasya are competing with each other in a new interesting game as they always do. At the beginning of the game Petya has to come up with an array of $$$N$$$ positive integers. Sum of all elements in his array should be equal to $$$S$$$. Then Petya has to select an integer $$$K$$$ such that $$$0 leq K leq S$$$....
1,400
true
false
false
false
false
true
false
false
false
false
3,928
863E
Luba needs your help again! Luba has _n_ TV sets. She knows that _i_-th TV set will be working from moment of time _l__i_ till moment _r__i_, inclusive. Luba wants to switch off one of TV sets in order to free the socket. Let's call some TV set redundant if after switching it off the number of integer moments of time w...
2,000
false
false
false
false
true
false
false
false
true
false
6,290
218B
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: it is up to a passenger to choose a plane to fly on; if the chosen plane has _x_ (_x_u2009>u20090) empty seats at the given moment, then the ticket for such a plane co...
1,100
false
false
true
false
false
false
false
false
false
false
8,965
670A
Problem - 670A - 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...
900
true
true
false
false
false
true
true
false
false
false
7,147
1016B
You are given two strings $$$s$$$ and $$$t$$$, both consisting only of lowercase Latin letters. The substring $$$s[l..r]$$$ is the string which is obtained by taking characters $$$s_l, s_{l + 1}, dots, s_r$$$ without changing the order. Each of the occurrences of string $$$a$$$ in a string $$$b$$$ is a position $$$i$$$...
1,300
false
false
true
false
false
false
true
false
false
false
5,611
1765K
You are given a square grid with $$$n$$$ rows and $$$n$$$ columns, where each cell has a non-negative integer written in it. There is a chip initially placed at the top left cell (the cell with coordinates $$$(1, 1)$$$). You need to move the chip to the bottom right cell (the cell with coordinates $$$(n, n)$$$). In one...
1,500
true
true
false
false
false
false
false
false
false
false
1,707
1368D
Gottfried learned about binary number representation. He then came up with this task and presented it to you. You are given a collection of $$$n$$$ non-negative integers $$$a_1, ldots, a_n$$$. You are allowed to perform the following operation: choose two distinct indices $$$1 leq i, j leq n$$$. If before the operation...
1,700
true
true
false
false
false
false
false
false
false
false
3,833
47C
Vasya trains to compose crossword puzzles. He can only compose crosswords of a very simplΠ΅ type so far. All of them consist of exactly six words; the words can be read only from top to bottom vertically and from the left to the right horizontally. The words are arranged in the form of a rectangular "eight" or infinity ...
2,000
false
false
true
false
false
false
false
false
false
false
9,740
648B
Statement is not available on English language Вася ΠΊΡƒΠΏΠΈΠ» стол, Ρƒ ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠ³ΠΎ _n_ Π½ΠΎΠΆΠ΅ΠΊ. КаТдая Π½ΠΎΠΆΠΊΠ° состоит ΠΈΠ· Π΄Π²ΡƒΡ… частСй, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ ΡΠΎΠ΅Π΄ΠΈΠ½ΡΡŽΡ‚ΡΡ Π΄Ρ€ΡƒΠ³ с Π΄Ρ€ΡƒΠ³ΠΎΠΌ. КаТдая Ρ‡Π°ΡΡ‚ΡŒ ΠΌΠΎΠΆΠ΅Ρ‚ Π±Ρ‹Ρ‚ΡŒ ΠΏΡ€ΠΎΠΈΠ·Π²ΠΎΠ»ΡŒΠ½ΠΎΠΉ ΠΏΠΎΠ»ΠΎΠΆΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎΠΉ Π΄Π»ΠΈΠ½Ρ‹, Π½ΠΎ гарантируСтся, Ρ‡Ρ‚ΠΎ ΠΈΠ· всСх 2_n_ частСй Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎ ΡΠΎΡΡ‚Π°Π²ΠΈΡ‚ΡŒ _n_ Π½ΠΎΠΆΠ΅ΠΊ ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²ΠΎΠΉ Π΄Π»ΠΈΠ½Ρ‹. ΠŸΡ€ΠΈ составлСнии...
800
false
false
false
false
false
true
false
false
true
false
7,226
1C
Problem - 1C - Codeforces =============== xa0 ]( "85") polygon, the size and the number of angles could vary from one circus to another. In each corner of the arena there was a special pillar, and the rope strung between the pillars marked the arena edges. Recently the scientists from Berland have discovered t...
2,100
true
false
false
false
false
false
false
false
false
false
9,982
1729G
You are given two non-empty strings $$$s$$$ and $$$t$$$, consisting of Latin letters. In one move, you can choose an occurrence of the string $$$t$$$ in the string $$$s$$$ and replace it with dots. Your task is to remove all occurrences of the string $$$t$$$ in the string $$$s$$$ in the minimum number of moves, and als...
2,100
false
false
false
true
false
false
false
false
false
false
1,912
1907F
Given an array of integers $$$a_1, a_2, ldots, a_n$$$. You can make two types of operations with this array: Shift: move the last element of array to the first place, and shift all other elements to the right, so you get the array $$$a_n, a_1, a_2, ldots, a_{n-1}$$$. Reverse: reverse the whole array, so you get the a...
1,800
false
true
false
false
false
false
false
false
true
false
859
1907E
Given a non-negative integer number $$$n$$$ ($$$n ge 0$$$). Let's say a triple of non-negative integers $$$(a, b, c)$$$ is good if $$$a + b + c = n$$$, and $$$digsum(a) + digsum(b) + digsum(c) = digsum(n)$$$, where $$$digsum(x)$$$ is the sum of digits of number $$$x$$$. For example, if $$$n = 26$$$, then the pair $$$(4...
1,600
false
false
false
false
false
false
true
false
false
false
860
222B
The Free Meteor Association (FMA) has got a problem: as meteors are moving, the Universal Cosmic Descriptive Humorous Program (UCDHP) needs to add a special module that would analyze this movement. UCDHP stores some secret information about meteors as an _n_u2009Γ—u2009_m_ table with integers in its cells. The order of ...
1,300
false
false
true
false
true
false
false
false
false
false
8,951
1720E
Misha has a square $$$n imes n$$$ matrix, where the number in row $$$i$$$ and column $$$j$$$ is equal to $$$a_{i, j}$$$. Misha wants to modify the matrix to contain exactly $$$k$$$ distinct integers. To achieve this goal, Misha can perform the following operation zero or more times: 1. choose any square submatrix of t...
2,700
true
true
true
false
true
true
false
false
false
false
1,960
109A
Problem - 109A - 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
9,449
1699B
You are given two even integers $$$n$$$ and $$$m$$$. Your task is to find any binary matrix $$$a$$$ with $$$n$$$ rows and $$$m$$$ columns where every cell $$$(i,j)$$$ has exactly two neighbours with a different value than $$$a_{i,j}$$$. Two cells in the matrix are considered neighbours if and only if they share a side....
900
false
false
false
false
false
true
false
false
false
false
2,086
1450C1
The only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version. Errichto gave Monogon the following challenge in order to intimidate him from taking his top contributor spot on Codeforces. In a Tic-Tac-Toe grid, there are $$$n$$$ rows and $$$n$$$ columns. ...
2,100
true
false
false
false
false
true
false
false
false
false
3,436
1370B
# GCD Compression Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes Ashish has an array a of consisting of 2n positive integers. He wants to compress a into an array b of size n βˆ’ 1. To do this, he first discards exactly 2 (any two) elements from a. He then per...
1,100
true
false
false
false
false
true
false
false
false
false
3,820
1879E
This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If you use some other programming language, consult its documentation. You m...
2,400
false
false
true
false
false
true
true
false
false
true
1,006
1288F
You are given a bipartite graph: the first part of this graph contains $$$n_1$$$ vertices, the second part contains $$$n_2$$$ vertices, and there are $$$m$$$ edges. The graph can contain multiple edges. Initially, each edge is colorless. For each edge, you may either leave it uncolored (it is free), paint it red (it co...
2,900
false
false
false
false
false
true
false
false
false
false
4,247
313E
Ilya has recently taken up archaeology. He's recently found two numbers, written in the _m_-based notation. Each of the found numbers consisted of exactly _n_ digits. Ilya immediately started looking for information about those numbers. He learned that the numbers are part of a cyphered code and the one who can decyphe...
2,300
false
true
false
false
true
true
false
false
false
false
8,591
903D
Problem - 903D - 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
true
false
false
false
true
false
false
false
false
false
6,131
930A
In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are _n_ inflorescences, numbered from 1 to _n_. Inflorescence number 1 is situated near base of tree and any other inflorescence with number _i_ (_i_u2009>u20091) is situated at t...
1,500
false
false
false
false
false
false
false
false
false
true
5,986
794C
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company. To settle this problem, they've decided to play a game. The company name will consist of _n_ letters. Oleg and Igor e...
1,800
false
true
false
false
false
false
false
false
true
false
6,598
1750B
A binary string is a string consisting only of the characters 0 and 1. You are given a binary string $$$s$$$. For some non-empty substring$$$^dagger$$$ $$$t$$$ of string $$$s$$$ containing $$$x$$$ characters 0 and $$$y$$$ characters 1, define its cost as: $$$x cdot y$$$, if $$$x > 0$$$ and $$$y > 0$$$; $$$x^2$$$, if ...
800
false
true
true
false
false
false
true
false
false
false
1,784
1238D
The string $$$t_1t_2 dots t_k$$$ is good if each letter of this string belongs to at least one palindrome of length greater than 1. A palindrome is a string that reads the same backward as forward. For example, the strings A, BAB, ABBA, BAABBBAAB are palindromes, but the strings AB, ABBBAA, BBBA are not. Here are some ...
1,900
false
false
false
true
false
false
false
true
false
false
4,500
1276E
There are four stones on an infinite line in integer coordinates $$$a_1, a_2, a_3, a_4$$$. The goal is to have the stones in coordinates $$$b_1, b_2, b_3, b_4$$$. The order of the stones does not matter, that is, a stone from any position $$$a_i$$$ can end up in at any position $$$b_j$$$, provided there is a required n...
3,500
false
false
false
false
false
true
false
false
false
false
4,311
129A
Olga came to visit the twins Anna and Maria and saw that they have many cookies. The cookies are distributed into bags. As there are many cookies, Olga decided that it's no big deal if she steals a bag. However, she doesn't want the sisters to quarrel because of nothing when they divide the cookies. That's why Olga wan...
900
false
false
true
false
false
false
false
false
false
false
9,365
707A
Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead. As you may know, the coolest photos are on the film (because you can specify the hashtag #film for such). Brain took a lo...
800
false
false
true
false
false
false
false
false
false
false
6,994
1254B2
This is the harder version of the problem. In this version, 1≀n≀106 and 0≀ai≀106. You can hack this problem if you locked it. But you can hack the previous problem only if you locked both problems Christmas is coming, and our protagonist, Bob, is preparing a spectacular present for his long-time best friend Alice. This...
2,100
true
true
false
false
false
true
false
false
false
false
4,414
1868F
Entering senior high school life, Tom is attracted by LIS problems, not only the Longest Increasing Subsequence problem, but also the Largest Interval Sum problem. Now he gets a really interesting problem from his friend Daniel. However, it seems too hard for him to solve it, so he asks you for help. Given an array $$$...
3,500
false
true
true
false
true
false
false
false
false
false
1,062
354E
We know that lucky digits are digits 4 and 7, however Vasya's got another favorite digit 0 and he assumes it also is lucky! Lucky numbers are such non-negative integers whose decimal record only contains lucky digits. For example, numbers 0,u200947,u20097074 are lucky, but 1,u20097377,u2009895,u2009 -7 are not. Vasya h...
2,200
false
false
false
true
false
true
false
false
false
false
8,414
178A2
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below. The playing field is a sequence of _n_ non-negative integers _a__i_ numbered from 1 to _n_. The goal of the game is to make numbers _a_1,u2009_a_2,u2009...,u2009_a__k_ (i.e....
1,000
false
true
false
false
false
false
false
false
false
false
9,139
1400A
A binary string is a string where each character is either 0 or 1. Two binary strings $$$a$$$ and $$$b$$$ of equal length are similar, if they have the same character in some position (there exists an integer $$$i$$$ such that $$$a_i = b_i$$$). For example: 10010 and 01111 are similar (they have the same character in ...
800
false
false
false
false
false
true
false
false
false
false
3,672
1515D
To satisfy his love of matching socks, Phoenix has brought his $$$n$$$ socks ($$$n$$$ is even) to the sock store. Each of his socks has a color $$$c_i$$$ and is either a left sock or right sock. Phoenix can pay one dollar to the sock store to either: recolor a sock to any color $$$c'$$$ $$$(1 le c' le n)$$$ turn a le...
1,500
false
true
false
false
false
false
false
false
true
false
3,088
1334G
You are given a permutation $$$p$$$ consisting of exactly $$$26$$$ integers from $$$1$$$ to $$$26$$$ (since it is a permutation, each integer from $$$1$$$ to $$$26$$$ occurs in $$$p$$$ exactly once) and two strings $$$s$$$ and $$$t$$$ consisting of lowercase Latin letters. A substring $$$t'$$$ of string $$$t$$$ is an o...
2,900
false
false
false
false
false
false
true
false
false
false
4,031
896C
β€” Willem... β€” What's the matter? β€” It seems that there's something wrong with Seniorious... β€” I'll have a look... Seniorious is made by linking special talismans in particular order. After over 500 years, the carillon is now in bad condition, so Willem decides to examine it thoroughly. Seniorious has _n_ pieces of tali...
2,600
false
false
false
false
true
false
false
false
false
false
6,163
195D
Problem - 195D - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,900
true
false
false
false
false
false
false
false
true
false
9,060
1476D
There are $$$n + 1$$$ cities, numbered from $$$0$$$ to $$$n$$$. $$$n$$$ roads connect these cities, the $$$i$$$-th road connects cities $$$i - 1$$$ and $$$i$$$ ($$$i in [1, n]$$$). Each road has a direction. The directions are given by a string of $$$n$$$ characters such that each character is either L or R. If the $$$...
1,700
false
false
true
true
false
false
false
false
false
false
3,294
1466I
What walks on four feet in the morning, two in the afternoon, and three at night? This is an interactive problem. This problem doesn't support hacks. Sphinx's duty is to guard the city of Thebes by making sure that no unworthy traveler crosses its gates. Only the ones who answer her riddle timely and correctly (or get ...
3,400
false
false
false
false
true
false
false
true
false
false
3,358
1042B
Berland shop sells $$$n$$$ kinds of juices. Each juice has its price $$$c_i$$$. Each juice includes some set of vitamins in it. There are three types of vitamins: vitamin "A", vitamin "B" and vitamin "C". Each juice can contain one, two or all three types of vitamins in it. Petya knows that he needs all three types of ...
1,200
false
false
true
true
false
false
true
false
false
false
5,488
855G
After destroying all of Voldemort's Horcruxes, Harry and Voldemort are up for the final battle. They each cast spells from their wands and the spells collide. The battle scene is Hogwarts, which can be represented in the form of a tree. There are, in total, _n_ places in Hogwarts joined using _n_u2009-u20091 undirected...
3,300
false
false
false
true
false
false
false
false
false
true
6,321
1454E
You are given an undirected graph consisting of $$$n$$$ vertices and $$$n$$$ edges. It is guaranteed that the given graph is connected (i.xa0e. it is possible to reach any vertex from any other vertex) and there are no self-loops and multiple edges in the graph. Your task is to calculate the number of simple paths of l...
2,000
false
false
false
false
false
false
false
false
false
true
3,404
258D
The Little Elephant loves permutations of integers from 1 to _n_ very much. But most of all he loves sorting them. To sort a permutation, the Little Elephant repeatedly swaps some elements. As a result, he must receive a permutation 1,u20092,u20093,u2009...,u2009_n_. This time the Little Elephant has permutation _p_1,u...
2,600
true
false
false
true
false
false
false
false
false
false
8,799
73E
Vasya plays The Elder Trolls III: Morrowindows. He has a huge list of items in the inventory, however, there is no limits on the size of things. Vasya does not know the total amount of items but he is sure that are not more than _x_ and not less than 2 items in his inventory. A new patch for the game appeared to view i...
2,400
true
false
false
false
false
false
false
false
false
false
9,598
1851A
One day, Vlad became curious about who he can have a conversation with on the escalator in the subway. There are a total of $$$n$$$ passengers. The escalator has a total of $$$m$$$ steps, all steps indexed from $$$1$$$ to $$$m$$$ and $$$i$$$-th step has height $$$i cdot k$$$. Vlad's height is $$$H$$$ centimeters. Two p...
800
true
false
false
false
false
true
true
false
false
false
1,174
209A
Problem - 209A - Codeforces =============== xa0 and (blue) are zebroids and sequence (red; red) is not a zebroid. Now Polycarpus wonders, how many ways there are to pick a zebroid subsequence from this sequence. Help him solve the problem, find the number of ways modulo 1000000007 (109u2009+u20097). Input The...
1,600
true
false
false
true
false
false
false
false
false
false
8,996
1526A
You are given an array $$$a$$$ of $$$2n$$$ distinct integers. You want to arrange the elements of the array in a circle such that no element is equal to the the arithmetic mean of its $$$2$$$ neighbours. More formally, find an array $$$b$$$, such that: $$$b$$$ is a permutation of $$$a$$$. For every $$$i$$$ from $$$...
800
false
false
false
false
false
true
false
false
true
false
3,036
1891A
You are given an array of integers $$$a_1, a_2, ldots, a_n$$$. In one operation, you do the following: Choose a non-negative integer $$$m$$$, such that $$$2^m leq n$$$. Subtract $$$1$$$ from $$$a_i$$$ for all integers $$$i$$$, such that $$$1 leq i leq 2^m$$$. Can you sort the array in non-decreasing order by performi...
800
false
false
false
false
false
true
false
false
true
false
957
1423G
Sarah has always been a lover of nature, and a couple of years ago she saved up enough money to travel the world and explore all the things built by nature over its lifetime on earth. During this time she visited some truly special places which were left untouched for centuries, from watching icebergs in freezing weath...
3,500
false
false
false
false
true
false
false
false
false
false
3,557
343A
Mad scientist Mike is building a time machine in his spare time. To finish the work, he needs a resistor with a certain resistance value. However, all Mike has is lots of identical resistors with unit resistance _R_0u2009=u20091. Elements with other resistance can be constructed from these resistors. In this problem, w...
1,600
true
false
false
false
false
false
false
false
false
false
8,463
678C
Problem - 678C - Codeforces =============== xa0 ]( "Educational Codeforces Round 13") . Output Print the only integer _s_ β€” the maximum number of chocolates Joty can get. Note that the answer can be too large, so you should use 64-bit integer type to store it. In C++ you can use the long long integer type ...
1,600
true
false
true
false
false
false
false
false
false
false
7,114
138D
Recently Roma has become the happy owner of a new game World of Darkraft. This game combines elements of virtually all known genres, and on one of the later stages of the game Roma faced difficulties solving a puzzle. In this part Roma fights with a cunning enemy magician. The battle takes place on a rectangular field ...
2,500
false
false
false
true
false
false
false
false
false
false
9,322
787A
Problem - 787A - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,200
true
false
false
false
false
false
true
false
false
false
6,623
1956A
Nene invented a new game based on an increasing sequence of integers $$$a_1, a_2, ldots, a_k$$$. In this game, initially $$$n$$$ players are lined up in a row. In each of the rounds of this game, the following happens: Nene finds the $$$a_1$$$-th, $$$a_2$$$-th, $$$ldots$$$, $$$a_k$$$-th players in a row. They are kick...
800
false
true
false
false
true
false
true
true
false
false
540
1421A
Problem - 1421A - 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
true
false
false
false
false
false
false
false
false
3,574
1097A
Gennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, watch sunsets and play cards with tourists staying in his hotel. His favorite game is called "Mau-Mau". To play Mau-Mau, you need a pack of $$$52$$$ cards. Each card has a suit (Diamonds β€” D, Clubs β€” C, Spades β€” S...
800
false
false
true
false
false
false
true
false
false
false
5,224
1789D
Serval has two $$$n$$$-bit binary integer numbers $$$a$$$ and $$$b$$$. He wants to share those numbers with Toxel. Since Toxel likes the number $$$b$$$ more, Serval decides to change $$$a$$$ into $$$b$$$ by some (possibly zero) operations. In an operation, Serval can choose any positive integer $$$k$$$ between $$$1$$$ ...
2,200
false
false
true
false
false
true
true
false
false
false
1,545
1379E
Ivan is fond of genealogy. Currently he is studying a particular genealogical structure, which consists of some people. In this structure every person has either both parents specified, or none. Additionally, each person has exactly one child, except for one special person, who does not have any children. The people in...
2,800
true
false
false
true
false
true
false
false
false
false
3,774
1368E
# Ski Accidents Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 512 megabytes Arthur owns a ski resort on a mountain. There are n landing spots on the mountain numbered from 1 to n from the top to the foot of the mountain. The spots are connected with one-directional ski ...
2,500
false
true
false
false
false
true
false
false
false
true
3,832
261B
Maxim has opened his own restaurant! The restaurant has got a huge table, the table's length is _p_ meters. Maxim has got a dinner party tonight, _n_ guests will come to him. Let's index the guests of Maxim's restaurant from 1 to _n_. Maxim knows the sizes of all guests that are going to come to him. The _i_-th guest's...
1,900
true
false
false
true
false
false
false
false
false
false
8,789
1139B
You went to the store, selling $$$n$$$ types of chocolates. There are $$$a_i$$$ chocolates of type $$$i$$$ in stock. You have unlimited amount of cash (so you are not restricted by any prices) and want to buy as many chocolates as possible. However if you buy $$$x_i$$$ chocolates of type $$$i$$$ (clearly, $$$0 le x_i l...
1,000
false
true
true
false
false
false
false
false
false
false
5,033
1599C
Little Johnny Bubbles enjoys spending hours in front of his computer playing video games. His favorite game is Bubble Strike, fast-paced bubble shooting online game for two players. Each game is set in one of the N maps, each having different terrain configuration. First phase of each game decides on which map the game...
2,000
true
false
false
false
false
false
false
false
false
false
2,662
1495D
We define a spanning tree of a graph to be a BFS tree rooted at vertex $$$s$$$ if and only if for every node $$$t$$$ the shortest distance between $$$s$$$ and $$$t$$$ in the graph is equal to the shortest distance between $$$s$$$ and $$$t$$$ in the spanning tree. Given a graph, we define $$$f(x,y)$$$ to be the number o...
2,600
true
false
false
false
false
false
false
false
false
true
3,193
1282C
Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes. The exam consists of $$$n$$$ problems that can be solved in $$$T$$$ minutes. Thus, the exam begins at time $$$0$$$ and ends at time $$$T$$$. Petya can leave the exam at ...
1,800
false
true
false
false
false
false
false
false
true
false
4,283
758A
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are _n_ citizens, the welfare of each of them is estimated as the integer in _a__i_ burles (burle is the currency in Berlan...
800
true
false
true
false
false
false
false
false
false
false
6,757