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
1982A
Dima loves watching soccer. In such a game, the score on the scoreboard is represented as $$$x$$$ : $$$y$$$, where $$$x$$$ is the number of goals of the first team, and $$$y$$$ is the number of goals of the second team. At any given time, only one team can score a goal, so the score $$$x$$$ : $$$y$$$ can change to eith...
800
true
true
true
false
false
false
false
false
true
false
396
1065C
There is a toy building consisting of $$$n$$$ towers. Each tower consists of several cubes standing on each other. The $$$i$$$-th tower consists of $$$h_i$$$ cubes, so it has height $$$h_i$$$. Let's define operation slice on some height $$$H$$$ as following: for each tower $$$i$$$, if its height is greater than $$$H$$$...
1,600
false
true
false
false
false
false
false
false
false
false
5,386
1304E
Gildong was hiking a mountain, walking by millions of trees. Inspired by them, he suddenly came up with an interesting idea for trees in data structures: What if we add another edge in a tree? Then he found that such tree-like graphs are called 1-trees. Since Gildong was bored of solving too many tree problems, he want...
2,000
false
false
false
false
true
false
false
false
false
false
4,167
1710D
Rhodoks has a tree with $$$n$$$ vertices, but he doesn't remember its structure. The vertices are indexed from $$$1$$$ to $$$n$$$. A segment $$$[l,r]$$$ ($$$1 leq l leq r leq n$$$) is good if the vertices with indices $$$l$$$, $$$l + 1$$$, ..., $$$r$$$ form a connected component in Rhodoks' tree. Otherwise, it is bad. ...
3,400
false
false
false
false
false
true
false
false
false
false
2,017
1411D
Currently, XXOC's rap is a string consisting of zeroes, ones, and question marks. Unfortunately, haters gonna hate. They will write $$$x$$$ angry comments for every occurrence of subsequence 01 and $$$y$$$ angry comments for every occurrence of subsequence 10. You should replace all the question marks with 0 or 1 in su...
2,100
false
true
true
false
false
false
true
false
false
false
3,618
1941D
Rudolf and Bernard decided to play a game with their friends. $$$n$$$ people stand in a circle and start throwing a ball to each other. They are numbered from $$$1$$$ to $$$n$$$ in the clockwise order. Let's call a transition a movement of the ball from one player to his neighbor. The transition can be made clockwise o...
1,200
false
false
true
true
false
false
false
false
false
false
636
2036D
One morning, Polycarp woke up and realized that $$$1543$$$ is the most favorite number in his life. The first thing that Polycarp saw that day as soon as he opened his eyes was a large wall carpet of size $$$n$$$ by $$$m$$$ cells; $$$n$$$ and $$$m$$$ are even integers. Each cell contains one of the digits from $$$0$$$ ...
1,300
false
false
true
false
false
false
true
false
false
false
49
1790G
You are given an undirected connected graph, some vertices of which contain tokens and/or bonuses. Consider a game involving one player xa0β€” you. You can move tokens according to the following rules: At the beginning of the game, you can make exactly one turn: move any token to any adjacent vertex. If the movement of...
2,300
false
false
false
false
false
true
false
false
false
true
1,536
1760B
In order to write a string, Atilla needs to first learn all letters that are contained in the string. Atilla needs to write a message which can be represented as a string $$$s$$$. He asks you what is the minimum alphabet size required so that one can write this message. The alphabet of size $$$x$$$ ($$$1 leq x leq 26$$...
800
false
true
true
false
false
false
false
false
false
false
1,754
1554B
You are given $$$n$$$ integers $$$a_1, a_2, ldots, a_n$$$ and an integer $$$k$$$. Find the maximum value of $$$i cdot j - k cdot (a_i a_j)$$$ over all pairs $$$(i, j)$$$ of integers with $$$1 le i < j le n$$$. Here, $$$$$$ is the xa0β€” the number of test cases. The first line of each test case contains two integers $$$...
1,700
true
true
false
false
false
false
true
false
false
false
2,865
257B
Petya and Vasya decided to play a little. They found _n_ red cubes and _m_ blue cubes. The game goes like that: the players take turns to choose a cube of some color (red or blue) and put it in a line from left to right (overall the line will have _n_u2009+u2009_m_ cubes). Petya moves first. Petya's task is to get as m...
1,300
false
true
true
false
false
false
false
false
false
false
8,806
1714C
Problem - 1714C - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
false
true
false
false
false
false
false
false
false
false
1,998
1704G
Mio has an array $$$a$$$ consisting of $$$n$$$ integers, and an array $$$b$$$ consisting of $$$m$$$ integers. Mio can do the following operation to $$$a$$$: Choose an integer $$$i$$$ ($$$1 leq i leq n$$$) that has not been chosen before, then add $$$1$$$ to $$$a_i$$$, subtract $$$2$$$ from $$$a_{i+1}$$$, add $$$3$$$ t...
3,500
true
false
false
false
false
true
false
false
false
false
2,049
1616C
An array $$$a_1, a_2, ldots, a_n$$$ is good if and only if for every subsegment $$$1 leq l leq r leq n$$$, the following holds: $$$a_l + a_{l + 1} + ldots + a_r = frac{1}{2}(a_l + a_r) cdot (r - l + 1)$$$. You are given an array of integers $$$a_1, a_2, ldots, a_n$$$. In one operation, you can replace any one element o...
1,500
true
false
true
false
false
false
true
false
false
false
2,554
952B
Problem - 952B - Codeforces =============== xa0
1,900
false
false
false
false
false
false
true
false
false
false
5,915
45H
The Berland capital (as you very well know) contains _n_ junctions, some pairs of which are connected by two-way roads. Unfortunately, the number of traffic jams in the capital has increased dramatically, that's why it was decided to build several new roads. Every road should connect two junctions. The city administrat...
2,100
false
false
false
false
false
false
false
false
false
true
9,752
1409D
Problem - 1409D - 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
true
false
false
false
false
false
false
false
false
3,624
1701E
You wanted to write a text $$$t$$$ consisting of $$$m$$$ lowercase Latin letters. But instead, you have written a text $$$s$$$ consisting of $$$n$$$ lowercase Latin letters, and now you want to fix it by obtaining the text $$$t$$$ from the text $$$s$$$. Initially, the cursor of your text editor is at the end of the tex...
2,500
false
true
false
true
false
false
true
false
false
false
2,072
758C
Problem - 758C - 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
true
false
false
true
false
true
false
false
6,755
850E
The presidential election is coming in Bearland next year! Everybody is so excited about this! So far, there are three candidates, Alice, Bob, and Charlie. There are _n_ citizens in Bearland. The election result will determine the life of all citizens of Bearland for many years. Because of this great responsibility, ea...
2,800
true
false
false
false
false
false
true
false
false
false
6,347
1271A
A new delivery of clothing has arrived today to the clothing store. This delivery consists of $$$a$$$ ties, $$$b$$$ scarves, $$$c$$$ vests and $$$d$$$ jackets. The store does not sell single clothing items β€” instead, it sells suits of two types: a suit of the first type consists of one tie and one jacket; a suit of t...
800
true
true
false
false
false
false
true
false
false
false
4,335
1184E1
Heidi found out that the Daleks have created a network of bidirectional Time Corridors connecting different destinations (at different times!).xa0She suspects that they are planning another invasion on the entire Space and Time. In order to counter the invasion, she plans to deploy a trap in the Time Vortex, along a ca...
1,900
false
false
false
false
false
false
false
false
false
true
4,783
1766D
Let's name a pair of positive integers $$$(x, y)$$$ lucky if the greatest common divisor of them is equal to $$$1$$$ ($$$gcd(x, y) = 1$$$). Let's define a chain induced by $$$(x, y)$$$ as a sequence of pairs $$$(x, y)$$$, $$$(x + 1, y + 1)$$$, $$$(x + 2, y + 2)$$$, $$$dots$$$, $$$(x + k, y + k)$$$ for some integer $$$k...
1,600
true
false
false
false
false
false
false
false
false
false
1,700
786D
Rick is in love with Unity. But Mr. Meeseeks also love Unity, so Rick and Mr. Meeseeks are "love rivals". Unity loves rap, so it decided that they have to compete in a rap game (battle) in order to choose the best. Rick is too nerds, so instead he's gonna make his verse with running his original algorithm on lyrics "Ra...
3,400
false
false
false
false
true
false
false
false
false
false
6,625
1799B
You are given an array $$$a_1, a_2, ldots, a_n$$$ of positive integers. You can make this operation multiple (possibly zero) times: Choose two indices $$$i$$$, $$$j$$$ ($$$1 leq i, j leq n$$$, $$$i eq j$$$). Assign $$$a_i := lceil frac{a_i}{a_j} ceil$$$. Here $$$lceil x ceil$$$ denotes $$$x$$$ rounded up to the sm...
1,200
true
true
false
false
false
true
true
false
false
false
1,483
1154B
You are given a sequence $$$a_1, a_2, dots, a_n$$$ consisting of $$$n$$$ integers. You can choose any non-negative integer $$$D$$$ (i.e. $$$D ge 0$$$), and for each $$$a_i$$$ you can: add $$$D$$$ (only once), i.u2009e. perform $$$a_i := a_i + D$$$, or subtract $$$D$$$ (only once), i.u2009e. perform $$$a_i := a_i - D$...
1,200
true
false
false
false
false
false
false
false
false
false
4,942
1204B
Mislove had an array $$$a_1$$$, $$$a_2$$$, $$$cdots$$$, $$$a_n$$$ of $$$n$$$ positive integers, but he has lost it. He only remembers the following facts about it: The number of different numbers in the array is not less than $$$l$$$ and is not greater than $$$r$$$; For each array's element $$$a_i$$$ either $$$a_i = ...
900
true
true
false
false
false
false
false
false
false
false
4,674
1227F1
Your program fails again. This time it gets "Wrong answer on test 233" . This is the easier version of the problem. In this version $$$1 le n le 2000$$$. You can hack this problem only if you solve and lock both problems. The problem is about a test containing $$$n$$$ one-choice-questions. Each of the questions contain...
2,200
false
false
false
true
false
false
false
false
false
false
4,538
1209C
You are given a sequence of $$$n$$$ digits $$$d_1d_2 dots d_{n}$$$. You need to paint all the digits in two colors so that: each digit is painted either in the color $$$1$$$ or in the color $$$2$$$; if you write in a row from left to right all the digits painted in the color $$$1$$$, and then after them all the digit...
1,500
false
true
true
false
false
true
false
false
false
false
4,644
1399D
You are given a binary string $$$s$$$ consisting of $$$n$$$ zeros and ones. Your task is to divide the given string into the minimum number of subsequences in such a way that each character of the string belongs to exactly one subsequence and each subsequence looks like "010101 ..." or "101010 ..." (i.e. the subsequenc...
1,500
false
true
true
false
true
true
false
false
false
false
3,676
1975A
Mocha likes arrays, so before her departure, Bazoka gave her an array $$$a$$$ consisting of $$$n$$$ positive integers as a gift. Now Mocha wants to know whether array $$$a$$$ could become sorted in non-decreasing order after performing the following operation some (possibly, zero) times: Split the array into two parts...
800
false
true
true
false
false
false
true
false
true
false
442
1033F
Alice has a computer that operates on $$$w$$$-bit integers. The computer has $$$n$$$ registers for values. The current content of the registers is given as an array $$$a_1, a_2, ldots, a_n$$$. The computer uses so-called "number gates" to manipulate this data. Each "number gate" takes two registers as inputs and calcul...
2,800
true
false
false
false
false
false
true
false
false
false
5,530
1523F
Problem - 1523F - 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,300
false
false
false
true
false
false
false
false
false
false
3,045
1977B
You are given a positive integer $$$x$$$. Find any array of integers $$$a_0, a_1, ldots, a_{n-1}$$$ for which the following holds: $$$1 le n le 32$$$, $$$a_i$$$ is $$$1$$$, $$$0$$$, or $$$-1$$$ for all $$$0 le i le n - 1$$$, $$$x = displaystyle{sum_{i=0}^{n - 1}{a_i cdot 2^i}}$$$, There does not exist an index $$$0...
1,100
true
true
false
false
false
true
false
false
false
false
426
201A
Problem - 201A - 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
true
false
true
false
false
false
false
9,039
241C
Mirror Box is a name of a popular game in the Iranian National Amusement Park (INAP). There is a wooden box, 105 cm long and 100 cm high in this game. Some parts of the box's ceiling and floor are covered by mirrors. There are two negligibly small holes in the opposite sides of the box at heights _h__l_ and _h__r_ cent...
2,000
false
false
true
false
false
false
false
false
false
false
8,873
1342E
Problem - 1342E - 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,300
true
false
false
false
false
false
false
false
false
false
3,995
1603E
A sequence of integers $$$b_1, b_2, ldots, b_m$$$ is called good if $$$max(b_1, b_2, ldots, b_m) cdot min(b_1, b_2, ldots, b_m) ge b_1 + b_2 + ldots + b_m$$$. A sequence of integers $$$a_1, a_2, ldots, a_n$$$ is called perfect if every non-empty subsequence of $$$a$$$ is good. YouKn0wWho has two integers $$$n$$$ and $$...
3,200
true
false
false
true
false
false
false
false
false
false
2,639
255E
Problem - 255E - 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
true
false
false
false
false
false
false
false
8,810
1910B
Monocarp is a security guard in Berland State University. Every day, he tracks how many people and at what time enter and leave the university. He writes this information down as follows: when someone enters the university, Monocarp writes a plus sign '+'; when someone leaves the university, Monocarp writes a minus s...
1,600
false
true
false
false
false
false
false
false
false
false
846
567A
All cities of Lineland are located on the _Ox_ coordinate axis. Thus, each city is associated with its position _x__i_ β€” a coordinate on the _Ox_ axis. No two cities are located at a single point. Lineland residents love to send letters to each other. A person may send a letter only if the recipient lives in another ci...
900
false
true
true
false
false
false
false
false
false
false
7,584
346D
The boss of the Company of Robot is a cruel man. His motto is "Move forward Or Die!". And that is exactly what his company's product do. Look at the behavior of the company's robot when it is walking in the directed graph. This behavior has been called "Three Laws of Robotics": Law 1. The Robot will destroy itself whe...
2,600
false
false
false
true
false
false
false
false
false
true
8,446
1340F
Nastya is a competitive programmer, but she is only studying now. Recently, Denis told her about the way to check if the string is correct bracket sequence. After that, unexpectedly, Nastya came up with a much more complex problem that Denis couldn't solve. Can you solve it? A string $$$s$$$ is given. It consists of $$...
3,300
false
false
false
false
true
false
true
false
false
false
4,002
2005A
Narek has to spend 2 hours with some 2-year-old kids at the kindergarten. He wants to teach them competitive programming, and their first lesson is about palindromes. Narek found out that the kids only know the vowels of the English alphabet (the letters $$$mathtt{a}$$$, $$$mathtt{e}$$$, $$$mathtt{i}$$$, $$$mathtt{o}$$...
900
true
true
false
false
false
true
false
false
false
false
224
1603D
Problem - 1603D - 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,000
false
false
false
true
false
false
false
false
false
false
2,640
756E
There are _n_ types of coins in Byteland. Conveniently, the denomination of the coin type _k_ divides the denomination of the coin type _k_u2009+u20091, the denomination of the coin type 1 equals 1 tugrick. The ratio of the denominations of coin types _k_u2009+u20091 and _k_ equals _a__k_. It is known that for each _x_...
3,200
true
false
false
true
false
false
false
false
false
false
6,766
1312E
You are given an array $$$a_1, a_2, dots, a_n$$$. You can perform the following operation any number of times: Choose a pair of two neighboring equal elements $$$a_i = a_{i + 1}$$$ (if there is at least one such pair). Replace them by one element with value $$$a_i + 1$$$. After each such operation, the length of the ...
2,100
false
true
false
true
false
false
false
false
false
false
4,133
596B
Problem - 596B - 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
false
true
true
false
false
false
false
false
false
false
7,464
1210E
Wojtek has just won a maths competition in Byteland! The prize is admirable β€” a great book called 'Card Tricks for Everyone.' 'Great!' he thought, 'I can finally use this old, dusted deck of cards that's always been lying unused on my desk!' The first chapter of the book is 'How to Shuffle $$$k$$$ Cards in Any Order Yo...
2,700
true
false
false
false
false
false
false
false
false
false
4,632
1860B
Monocarp is going to make a purchase with cost of exactly $$$m$$$ burles. He has two types of coins, in the following quantities: coins worth $$$1$$$ burle: $$$a_1$$$ regular coins and infinitely many fancy coins; coins worth $$$k$$$ burles: $$$a_k$$$ regular coins and infinitely many fancy coins. Monocarp wants to m...
1,200
true
true
false
false
false
false
true
true
false
false
1,124
216B
One day _n_ students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people. We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student _A_ is an archenemy to student _B_, then stude...
1,700
false
false
true
false
false
false
false
false
false
false
8,975
1203C
Problem - 1203C - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,300
true
false
true
false
false
false
false
false
false
false
4,681
1690B
Kristina has two arrays $$$a$$$ and $$$b$$$, each containing $$$n$$$ non-negative integers. She can perform the following operation on array $$$a$$$ any number of times: apply a decrement to each non-zero element of the array, that is, replace the value of each element $$$a_i$$$ such that $$$a_i > 0$$$ with the value ...
800
false
true
true
false
false
false
false
false
false
false
2,142
1215E
Monocarp has arranged $$$n$$$ colored marbles in a row. The color of the $$$i$$$-th marble is $$$a_i$$$. Monocarp likes ordered things, so he wants to rearrange marbles in such a way that all marbles of the same color form a contiguos segment (and there is only one such segment for each color). In other words, Monocarp...
2,200
false
false
false
true
false
false
false
false
false
false
4,599
89E
The Fire Lord attacked the Frost Kingdom. He has already got to the Ice Fortress, where the Snow Queen dwells. He arranged his army on a segment _n_ in length not far from the city walls. And only the frost magician Solomon can save the Frost Kingdom. The _n_-long segment is located at a distance equal exactly to 1 fro...
2,900
false
true
false
false
false
false
false
false
false
false
9,525
1253E
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis. On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions ...
2,200
false
true
false
true
true
false
false
false
true
false
4,418
1700E
Little pirate Serega robbed a ship with puzzles of different kinds. Among all kinds, he liked only one, the hardest. A puzzle is a table of $$$n$$$ rows and $$$m$$$ columns, whose cells contain each number from $$$1$$$ to $$$n cdot m$$$ exactly once. To solve a puzzle, you have to find a sequence of cells in the table,...
2,600
false
false
false
false
false
true
true
false
false
false
2,078
1349C
Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with $$$n$$$ rows and $$$m$$$ columns. Each cell is either black or white. For each iteration of the game (the initial iteration is $$$0$$$...
2,000
false
false
true
false
false
false
false
false
false
true
3,962
1677A
Tokitsukaze has a permutation $$$p$$$ of length $$$n$$$. Recall that a permutation $$$p$$$ of length $$$n$$$ is a sequence $$$p_1, p_2, ldots, p_n$$$ consisting of $$$n$$$ distinct integers, each of which from $$$1$$$ to $$$n$$$ ($$$1 leq p_i leq n$$$). She wants to know how many different indices tuples $$$[a,b,c,d]$$...
1,600
false
false
false
true
true
false
true
false
false
false
2,206
1780A
Today Hayato came home from school with homework. In the assignment, Hayato was given an array $$$a$$$ of length $$$n$$$. The task was to find $$$3$$$ numbers in this array whose sum is odd. At school, he claimed that there are such $$$3$$$ numbers, but Hayato was not sure, so he asked you for help. Answer if there are...
800
false
true
false
false
false
true
false
false
false
false
1,594
1849D
You are given an array of $$$n$$$ integers, where each integer is either $$$0$$$, $$$1$$$, or $$$2$$$. Initially, each element of the array is blue. Your goal is to paint each element of the array red. In order to do so, you can perform operations of two types: pay one coin to choose a blue element and paint it red; ...
1,700
false
true
false
false
false
true
false
false
false
false
1,185
248E
Piglet has got a birthday today. His friend Winnie the Pooh wants to make the best present for him β€” a honey pot. Of course Winnie realizes that he won't manage to get the full pot to Piglet. In fact, he is likely to eat all the honey from the pot. And as soon as Winnie planned a snack on is way, the pot should initial...
2,600
true
false
false
true
false
false
false
false
false
false
8,839
1137D
This is an interactive problem. Misha likes to play cooperative games with incomplete information. Today he suggested ten his friends to play a cooperative game "Lake". Misha has already come up with a field for the upcoming game. The field for this game is a directed graph consisting of two parts. The first part is a ...
2,400
false
false
false
false
false
true
false
false
false
false
5,039
1929F
Having overcome all the difficulties and hardships, Sasha finally decided to marry his girlfriend. To do this, he needs to give her an engagement ring. However, his girlfriend does not like such romantic gestures, but she does like binary search trees$$$^{dagger}$$$. So Sasha decided to give her such a tree. After spen...
2,300
true
false
false
false
true
false
true
false
false
false
712
865A
Attention: we lost all the test cases for this problem, so instead of solving the problem, we need you to generate test cases. We're going to give you the answer, and you need to print a test case that produces the given answer. The original problem is in the following paragraph. People don't use cash as often as they ...
1,400
false
false
false
false
false
true
false
false
false
false
6,281
1549B
There is a chessboard of size $$$n$$$ by $$$n$$$. The square in the $$$i$$$-th row from top and $$$j$$$-th column from the left is labelled $$$(i,j)$$$. Currently, Gregor has some pawns in the $$$n$$$-th row. There are also enemy pawns in the $$$1$$$-st row. On one turn, Gregor moves one of his pawns. A pawn can move o...
800
false
true
true
true
false
false
false
false
false
true
2,899
1488E
A subsequence is a sequence that can be obtained from another sequence by removing some elements without changing the order of the remaining elements. A palindromic sequence is a sequence that is equal to the reverse of itself. You are given a sequence of $$$n$$$ integers $$$a_1, a_2, dots, a_n$$$. Any integer value ap...
2,200
false
false
false
true
true
false
false
false
false
false
3,235
2000H
Ksyusha decided to start a game development company. To stand out among competitors and achieve success, she decided to write her own game engine. The engine must support a set initially consisting of $$$n$$$ distinct integers $$$a_1, a_2, ldots, a_n$$$. The set will undergo $$$m$$$ operations sequentially. The operati...
2,200
false
false
true
false
true
false
true
true
false
false
256
1732B
A binary string is a string consisting only of the characters 0 and 1. You are given a binary string $$$s_1 s_2 ldots s_n$$$. It is necessary to make this string non-decreasing in the least number of operations. In other words, each character should be not less than the previous. In one operation, you can do the follow...
900
false
true
true
true
false
false
true
false
false
false
1,898
1746E2
The only difference between this problem and the hard version is the maximum number of questions. This is an interactive problem. There is a hidden integer $$$1 le x le n$$$ which you have to find. In order to find it you can ask at most $$$mathbf{53}$$$ questions. In each question you can choose a non-empty integer se...
3,200
false
false
false
true
false
false
false
false
false
false
1,805
1118D1
The only difference between easy and hard versions is the constraints. Polycarp has to write a coursework. The coursework consists of $$$m$$$ pages. Polycarp also has $$$n$$$ cups of coffee. The coffee in the $$$i$$$-th cup has $$$a_i$$$ caffeine in it. Polycarp can drink some cups of coffee (each one no more than once...
1,700
false
true
false
false
false
false
true
false
false
false
5,099
886E
One day Petya was solving a very interesting problem. But although he used many optimization techniques, his solution still got Time limit exceeded verdict. Petya conducted a thorough analysis of his program and found out that his function for finding maximum element in an array of _n_ positive integers was too slow. D...
2,400
true
false
false
true
false
false
false
false
false
false
6,204
977B
Two-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, "AZ", "AA", "ZA" β€” three distinct two-grams. You are given a string $$$s$$$ consisting of $$$n$$$ capital Latin letters. Your task is to find any two-gram contained in the given string as a substring (i.e. two consecutive cha...
900
false
false
true
false
false
false
false
false
false
false
5,823
1780B
While at Kira's house, Josuke saw a piece of paper on the table with a task written on it. The task sounded as follows. There is an array $$$a$$$ of length $$$n$$$. On this array, do the following: select an integer $$$k > 1$$$; split the array into $$$k$$$ subsegments $$$^dagger$$$; calculate the sum in each of $$$...
1,100
true
true
false
false
false
false
true
false
false
false
1,593
1543E
Finally, you have defeated Razor and now, you are the Most Wanted street racer. Sergeant Cross has sent the full police force after you in a deadly pursuit. Fortunately, you have found a hiding spot but you fear that Cross and his force will eventually find you. To increase your chances of survival, you want to tune an...
2,700
true
true
false
false
false
true
false
false
false
true
2,923
567B
Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected works of Berland leaders, the library has a reading room. Today was the pilot launch of an automated reading room visitors' accounting system! The scanner of the system is installed ...
1,300
false
false
true
false
false
false
false
false
false
false
7,583
979E
Kuro has recently won the "Most intelligent cat ever" contest. The three friends then decided to go to Katie's home to celebrate Kuro's winning. After a big meal, they took a small break then started playing games. Kuro challenged Katie to create a game with only a white paper, a pencil, a pair of scissors and a lot of...
2,400
false
false
false
true
false
false
false
false
false
false
5,807
1665B
You are given an array $$$a$$$ of $$$n$$$ integers. Initially there is only one copy of the given array. You can do operations of two types: 1. Choose any array and clone it. After that there is one more copy of the chosen array. 2. Swap two elements from any two copies (maybe in the same copy) on any positions. You ne...
900
false
true
false
false
false
true
false
false
true
false
2,289
18D
Last year Bob earned by selling memory sticks. During each of _n_ days of his work one of the two following events took place: A customer came to Bob and asked to sell him a 2_x_ MB memory stick. If Bob had such a stick, he sold it and got 2_x_ berllars. Bob won some programming competition and got a 2_x_ MB memory s...
2,000
false
true
false
true
false
false
true
false
false
false
9,902
1221G
You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. You have to write a number on each vertex of this graph, each number should be either $$$0$$$ or $$$1$$$. After that, you write a number on each edge equal to the sum of numbers on vertices incident to that edge. You have to choose the numbers y...
2,900
false
false
false
true
false
false
true
false
false
false
4,560
288E
Problem - 288E - 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
true
false
true
true
false
false
false
false
false
false
8,680
722B
You are given a text consisting of _n_ lines. Each line contains some space-separated words, consisting of lowercase English letters. We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels...
1,200
false
false
true
false
false
false
false
false
false
false
6,925
1091E
Bob is an active user of the social network Faithbug. On this network, people are able to engage in a mutual friendship. That is, if $$$a$$$ is a friend of $$$b$$$, then $$$b$$$ is also a friend of $$$a$$$. Each user thus has a non-negative amount of friends. This morning, somebody anonymously sent Bob the following li...
2,400
true
true
true
false
true
false
false
true
true
true
5,255
1920F2
The only difference between the two versions of this problem is the constraint on $$$q$$$. You can make hacks only if both versions of the problem are solved. Thomas is sailing around an island surrounded by the ocean. The ocean and island can be represented by a grid with $$$n$$$ rows and $$$m$$$ columns. The rows are...
3,000
false
false
false
false
true
false
false
true
false
true
766
1717E
Madoka wants to enter to "Novosibirsk State University", but in the entrance exam she came across a very difficult task: Given an integer $$$n$$$, it is required to calculate $$$sum{operatorname{lcm}(c, gcd(a, b))}$$$, for all triples of positive integers $$$(a, b, c)$$$, where $$$a + b + c = n$$$. In this problem $$$g...
2,200
true
false
false
false
false
false
false
false
false
false
1,977
1326F2
This is the hard version of the problem. The difference is constraints on the number of wise men and the time limit. You can make hacks only if all versions of this task are solved. $$$n$$$ wise men live in a beautiful city. Some of them know each other. For each of the $$$n!$$$ possible permutations $$$p_1, p_2, ldots...
3,200
true
false
false
true
false
false
false
false
false
false
4,080
1154A
Problem - 1154A - 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
false
false
false
false
false
false
false
false
4,943
23B
Problem - 23B - Codeforces =============== xa0 . Each of the following _t_ lines contains one integer number _n_ (1u2009≀u2009_n_u2009≀u2009105). Output For each test output in a separate line one number β€” the maximum amount of people that could stay in the end. Examples Input 1 3 Output 1
1,600
true
false
false
false
false
true
false
false
false
true
9,882
1290B
Let's call two strings $$$s$$$ and $$$t$$$ anagrams of each other if it is possible to rearrange symbols in the string $$$s$$$ to get a string, equal to $$$t$$$. Let's consider two strings $$$s$$$ and $$$t$$$ which are anagrams of each other. We say that $$$t$$$ is a reducible anagram of $$$s$$$ if there exists an inte...
1,800
false
false
false
false
true
true
false
true
false
false
4,245
132A
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequence of characters to print, using the following method. The integers of the array are processed one b...
1,300
false
false
true
false
false
false
false
false
false
false
9,347
1352C
Problem - 1352C - 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
true
false
false
3,950
853E
After long-term research and lots of experiments leading Megapolian automobile manufacturer Β«AutoVozΒ» released a brand new car model named Β«Lada MalinaΒ». One of the most impressive features of Β«Lada MalinaΒ» is its highly efficient environment-friendly engines. Consider car as a point in _Oxy_ plane. Car is equipped wit...
3,400
false
false
false
false
true
false
false
false
false
false
6,330
798B
Problem - 798B - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,300
false
false
false
true
false
false
true
false
false
false
6,580
525C
In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of _n_ sticks and an instrument. Each stick is characterized by its length _l__i_. Ilya decided to make a rectangle from the sticks. And due to his whim, he decided to make rectangles in such a way that...
1,600
true
true
false
false
false
false
false
false
true
false
7,734
576D
In the country there are exactly _n_ cities numbered with positive integers from 1 to _n_. In each city there is an airport is located. Also, there is the only one airline, which makes _m_ flights. Unfortunately, to use them, you need to be a regular customer of this company, namely, you have the opportunity to enjoy f...
2,700
false
false
false
true
false
false
false
false
false
false
7,540
1946E
Some permutation of length $$$n$$$ is guessed. You are given the indices of its prefix maximums and suffix maximums. Recall that a permutation of length $$$k$$$ is an array of size $$$k$$$ such that each integer from $$$1$$$ to $$$k$$$ occurs exactly once. Prefix maximums are the elements that are the maximum on the pr...
2,200
true
false
false
true
false
false
false
false
false
false
601
846D
Recently Luba bought a monitor. Monitor is a rectangular matrix of size _n_u2009Γ—u2009_m_. But then she started to notice that some pixels cease to work properly. Luba thinks that the monitor will become broken the first moment when it contains a square _k_u2009Γ—u2009_k_ consisting entirely of broken pixels. She knows ...
1,900
false
false
false
false
true
false
false
true
false
false
6,374
1381A1
This is the easy version of the problem. The difference between the versions is the constraint on $$$n$$$ and the required number of operations. You can make hacks only if all versions of the problem are solved. There are two binary strings $$$a$$$ and $$$b$$$ of length $$$n$$$ (a binary string is a string consisting o...
1,300
false
false
false
false
true
true
false
false
false
false
3,764
17A
Problem - 17A - Codeforces =============== xa0 and _k_ (0u2009≀u2009_k_u2009≀u20091000). Output Output YES if at least _k_ prime numbers from 2 to _n_ inclusively can be expressed as it was described above. Otherwise output NO. Examples Input 27 2 Output YES Input 45 7 Output NO Note In the first sample...
1,000
true
false
false
false
false
false
true
false
false
false
9,910
1497C1
Problem - 1497C1 - 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
true
false
false
false
false
3,186